How to add custom fonts to your Xcode project

To add custom fonts to your project you need to go through a few easy steps.

First, download the fonts you need. Usually, they are .ttf or .otf files. Drag and drop the files to the Project Navigator. It is best to put them all in one group named Fonts.

screen-shot-2016-11-04-at-19-59-11

Go to project’s Build Phases and make sure the files are included in Copy Bundle Resources.

screen-shot-2016-11-04-at-19-51-14

Then go to your Info.plist file and add the file names to the array called Fonts provided by application.

screen-shot-2016-11-04-at-19-50-35

At this point you can use your new fonts in your project. But there is one more thing, though. To use the fonts programmatically you need to know their names. Their names are not the same as the names of font files you just included into your project. Filenames can be anything ending with .otf or .ttf. Font names on the other hand look like these:

BebasNeueBold, BebasNeueBook, BebasNeueRegular, BebasNeue-Light, ProximaNova-Regular, ProximaNova-Bold, ProximaNova-Light, HelveticaNeue-Light, HelveticaNeue-Bold, CenturyGothic-Bold, CenturyGothic, MyriadPro-Regular

So, how do you know the proper font names? Just print all the font names to the console. Use this snippet:

 

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply

Your email address will not be published. Required fields are marked *