This tutorial will give an example of how to add a custom font to your iOS app that you can use in UIFont, UILabel, UITextView, etc.
- Open Info.plist
- Right click and choose “Add Row”.
- Start typing and select “Fonts provided by application”.
- Expand the row and next to Item 0 in the Value field enter the name of the font.
- Don’t forget to add the font file to your project and set its target. You can place it in a new folder called “Resources”.
To use the font use the following Swift 3 code:
let customFont = UIFont(name: "Custom Font Name", size: UIFont.systemFontSize) let customLabel = UILabel() customLabel.font = customFont
The “Custom Font Name” used is not necessarily the filename of the font file but rather the Font name. You can determine this by opening the font file on your Mac with Font Book. The font name is displayed in the title bar.