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.

  1. Open Info.plist
  2. Right click and choose “Add Row”.
  3. Start typing and select “Fonts provided by application”.
  4. Expand the row and next to Item 0 in the Value field enter the name of the font.
  5. 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.

 

Reference: https://developer.apple.com/documentation/uikit/uifont

How to add custom fonts to your iOS app in Swift with UIFont
Translate »