How to Import Fonts into Xcode (Swift 3)

Seriously, why?

So you’re in the process of building your first app… let’s jazz up that UI with some cool fonts! Here’s how to do it in 6 steps.

Step 1: Find a cool font and download it.

I used DaFont for my personal logo and found another nice font, Ember, for this project/blogpost. I picked Ember because it’s in the public domain, but you could easily pick a nice font and then send its designer a considerate donation. (I also really liked Boquerón, but maybe I’ll save it for another app project). Make sure that the font comes in either TFF (TrueType Format) or OTF (OpenType Format).

Step 2: Save your fonts AND drag them into your Xcode project.

When you drag your font folder into your project, make sure to “copy items as needed.”

I’ve dragged in my folder of downloaded fonts, ember.
Make sure you drag this font folder into your Xcode project, too!

Step 3: Click on your font folder to make sure they are included in your “Target Membership.”

Make sure that your fonts are included in your build target.

Step 4: Do a quick check, are your fonts in “Build Phases” -> “Bundle Resources”?

I had to drag in these files from my ember folder to get this to work.

Step 5: Manually type in the font names in your plist.

I manually typed in “Ember.otf” and “EmberIta.otf” here.

Step 6: Use the font!

With storyboard, find the font in your drag-down menu.

Select any view to change its font attribute and you’ll find that your new font is now an option!

Programmatically, select the font property on your label or text item. Below, I change the font of my button to the “Ember” font.

I called this changeFonts() function in viewDidLoad().
The GOOD: my Ember font is looking good. The BAD: Will Smith doesn’t want me to eat cheese.

Leave me a message and let me know what cool fonts you decide to import into your apps!

Resources:

DaFont.com

1001 Fonts

Font Squirrel