How to Add and Use Custom Fonts in Xcode

If you want to give your iOS app a more polished or fancy look, using custom fonts is a great option.

In this article, I'll show you how to add and use custom fonts in an Xcode project.

Prepare Custom Font Files

First, prepare the font files for the custom fonts you want to use.

Xcode supports TrueType Font (.ttf) and OpenType Font (.otf) files.

For this example, I'll add the following fonts downloaded from Google Fonts, but you can use any other fonts as well.

  • Gotu - Regular 400 (Gotu-Regular.ttf)
  • M PLUS 1p - Bold 700 (MPLUS1p-Bold.ttf)
  • Kosugi Maru - Regular 400 (KosugiMaru-Regular.ttf)

How to Add Custom Fonts in Xcode 1


Add Font Files to Your Xcode Project

Next, add the font files to your Xcode project.

In the Project Navigator, right-click your project directory, select New Group, and create a group named fonts.

This group is just for organization. You don't have to name it fonts, and you could also place the font files directly in the project root without creating a group.

How to Add Custom Fonts in Xcode 2


Drag and drop the font files you downloaded in Step 1 into the fonts group.

How to Add Custom Fonts in Xcode 3


When the options dialog appears, make sure to select your project under Add to targets, then click Finish.

How to Add Custom Fonts in Xcode 4

How to Add Custom Fonts in Xcode 5


Register Custom Fonts in Info.plist

Now, register the custom fonts in Info.plist.

In the Project Navigator, open Info.plist. Right-click on an empty area and select Add Row.

How to Add Custom Fonts in Xcode 6


Add the key "Fonts provided by application", then list the font file names you added in Step 1.

How to Add Custom Fonts in Xcode 7

How to Add Custom Fonts in Xcode 8


Use Custom Fonts in Interface Builder

Let's try using the registered fonts in Interface Builder.

Place a Label on the storyboard. With the label selected, open the Attributes Inspector, click the T icon for the Font property, and change the font from System to Custom.

How to Add Custom Fonts in Xcode 9


From the Family list, you can now select the custom fonts you registered.

How to Add Custom Fonts in Xcode 10

How to Add Custom Fonts in Xcode 11


Here's a comparison between the default system font and the custom fonts added in this example:

How to Add Custom Fonts in Xcode 12


Finally, note that the font's internal name may differ from the file name.

For example, the Kosugi Maru font file is named KosugiMaru-Regular.ttf, but when installed on macOS it actually appears in the Family list as MotoyaLMaru, not KosugiMaru.

How to Add Custom Fonts in Xcode 13


That's how to add and use custom fonts in an Xcode project.