Get font families

Sometimes a design might require a custom font to be used. This summary outlines the resources and steps required to get your custom fonts setup in your build.

I found this tutorial from Apple, so I created this post here as a bookmark to remind myself on how this works. This tutorial helps you understand what fonts are available in your application.

Within viewDidLoad() add this code and run a build.

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        for family: String in UIFont.familyNames {
            print("\(family)")
            for names: String in UIFont.fontNames(forFamilyName: family) {
                print("== \(names)")
            }
        }

    }
}

You should see something like this in your xcode console

xcode console

Adding Custom Fonts

In order to add custom fonts, you need to follow some key steps. Everything is clearly outlined in the link below

Adding a Custom Font to Your App

Keep in mind

If your build is missing the font or not showing up, make sure “Target Membership” is selected. And double check that you spelled the font correctly in your Info.plist. I always mess up on one of those steps.