This code below enabled me to create small caps text on iOS 12. However on iOS 13 it's stopped working.
iOS 12 log
.SFUIDisplay-Semibold
.SFUIDisplay-Semibold
iOS 13 log
.SFUI-Semibold
TimesNewRomanPSMT
It seems that the SFUI font has changed name at least in iOS 13, but has it also dropped support for small caps?
let font = UIFont.systemFont(ofSize: 20, weight: .semibold)
print(font.fontName)
let settings = [[UIFontDescriptor.FeatureKey.featureIdentifier: kLowerCaseType,
UIFontDescriptor.FeatureKey.typeIdentifier: kLowerCaseSmallCapsSelector]]
let attributes: [UIFontDescriptor.AttributeName: AnyObject] = [UIFontDescriptor.AttributeName.featureSettings: settings as AnyObject,
UIFontDescriptor.AttributeName.name: font.fontName as AnyObject]
let smallCapsFont = UIFont(descriptor: UIFontDescriptor(fontAttributes: attributes), size: 20)
print(smallCapsFont.fontName)