I'm using UIFont to change the default font in my app. the code is working fine on iOS 10 and below but it returns nil on iOS 11 , nothing has changed . I'm using swift 4
this is my code that returning nil :
UIFont(name: "AIranianSans", size: 20)
could you help me ? what is wrong ?
Try to check the available fonts
for familyName:String in UIFont.familyNames {
print("Family Name: \(familyName)")
for fontName:String in UIFont.fontNames(forFamilyName: familyName) {
print("--Font Name: \(fontName)")
}
}
May be the font spelling is different.
It looks like a custom font which you must have added as a resource in XCode. XCode 9 has a known issue of not adding resources to target when you include resources by drag and drop.
Check the target membership of your .ttf file in the file inspector.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With