AttributedTextView
AttributedTextView copied to clipboard
Default font changes in Xcode 11
Hi all, Why it switches to TimesNewRomanPSMT font in Xcode 11?
Thanks
AttributedTextView does not change any attributes by itself. It just takes the UILable, UITextview or NSAttributed text and applies whatever you specified. Indeed Apple made some changes in Xcode 11
As per Apple's official document https://developer.apple.com/fonts/
SF Pro:
This sans-serif typeface is the system font for iOS, macOS, and tvOS, and includes a rounded variant. It provides a consistent, legible, and friendly typographic voice.
SF Compact:
This sans-serif typeface is the system font for watchOS, and includes a rounded variant. It suits a wide range of content and is easily legible in a variety of contexts.
So we need to download and install SF Pro font and set UILabel attributed string font style with SF Pro Text Regular 18.0 to keep the same font style like Plain text have.
Quick update
In Attributer.swift I was changing:
open func font(_ font: UIFont?) -> Attributer { if font != nil { return fontName(font!.fontName.replacingOccurrences(of: ".", with: "")).size(font!.pointSize) } return self }
without the dot (.) and it worked for font, it was not changing to TimesNewRoman, but it's not working for font-weight.
still replaces for me see so https://stackoverflow.com/questions/59105193/asking-for-san-francisco-font-in-different-size-returns-a-times-new-roman-varian seems fontFamily should be used instead fontName