Trying to get SF Pro Display Thin Italics on iOS

Viewed 6183

I am writing an iOS app in Swift, and I want to use the system font, SF Pro. However, I can't seem to figure out how to set the font weight at the same time as making the text italic. I know this was possible with Helvetica Neue with

UIFont(name: "HelveticaNeue-UltraLightItalic", size: 24.0)

But when using the system font, I can only seem to do one or the other like this

UIFont.italicSystemFont(ofSize: 24)

or

UIFont.systemFont(ofSize: 75.0, weight: UIFontWeightThin)

I have seen SF Pro Display Thin Italic in Font Book, and I know you can use it in editing apps like Sketch and Photoshop, but I have yet to find a way to get iOS to display it.

4 Answers

As (an ugly) on-liner:

UIFont(descriptor: UIFont.systemFont(ofSize: 14, weight: .thin).fontDescriptor.withSymbolicTraits(.traitItalic)!, size: 14)
Related