NSFontAttributeName vs NSAttributedStringKey.font

前端 未结 2 2237
离开以前
离开以前 2021-02-20 16:29

I am having some trouble with Swift code in a library I have been using for a while. It seems related to some kind of version conflict, but I am not sure.

Here is the co

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-20 16:52

    Swift 4.2

    NSAttributedStringKey renamed NSAttributedString.Key. However for this particular issue you need to get the raw value so the solution would be NSAttributedString.Key.font.rawValue

    Take a look here for an in-depth explanation: https://stackoverflow.com/a/46459315/2440997

提交回复
热议问题