ARTICLES

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

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



Our Products

Kitemetrics
Keyword level attribution for Apple Search Ads. Optimize your bids and increase your revenue. Sign up for free at kitemetrics.com.

White Noise and Deep Sleep Sounds
Calming and relaxing sounds that will help you sleep like a baby tonight.
Download for free from the App Store.
Get it on Google Play.




Our Sponsors

Get Sleepy
Get Sleepy
The free podcast that puts you to sleep with meditative bedtime stories. Listen at getsleepy.com.