In this Xcode tutorial, I discuss the topic of adding a custom font to your iOS app and use it in your app’s interface.
Import font files to Xcode project:
Register Your Font File into Info .plist file :
Open the info.plist file and add a new property named ‘Fonts provided by application’. The raw key of this property is UIAppFonts.When the property is added, the property ‘Fonts provided by application’ key is an Array type and add new items to the array, one for each font file you imported. Names of the items should match imported font file names.
You can find out what other fonts are already available to use in your app on iOS by running the following code which prints out all the font names.
for fontFamily in UIFont.familyNames { for fontName in UIFont.fontNames(forFamilyName: fontFamily) { print("\(fontName)") } }
Use Code in helper class:
Easy to use:
@IBOutlet weak var lblName: UILabel! override func viewDidLoad() { super.viewDidLoad() lblName.font = UIFont.poppinsSemiBold(size: 14) }
Related tutorials:
Memory Management with ARC and Avoiding retain cycles with Weak and Unowned in Swift.
How to create Certificate Signing Request (CSR) in macOS (iOS) Keychain Access
Swift 5.2 Generics Explained - How to Use Generics in iOS Apps
How to generate .ipa file for In-House and distribute enterprise iOS app inside a company
How to Create an App ID and Bundle Identifier for your iOS App in Xcode 11 (2020)
Creating the iOS Development & Distribution Certificate and .p12 File
Development Xcode11 Import Development and Distribution Provisioning Profile
0 Comments