Add Custom Font in iOS Application Xcode 9

Adding custom font of your choice or of your business theme, in your iOS app is quite important. Custom fonts can enrich your app and transform it from just and app to an awesome app. Adding custom font in iOS application is a step by step process. In this article we have listed all the steps and in order, we have provided enough images so that you do not lose the track

A demo project has been created in which we will add a custom font. We assume that you have the basic knowledge of creating projects creating outlets and you have a custom font file. To begin with the demo app is a simple app with a UILabel and default font.

Demo app
  1. Go to your custom font folder and drag the font file in your project

    adding custom font Amarendrasingh.com
  2. Font Name and Font File name are two different things and are both required to get Font Name open your font file. The resulting font book will display your font name and type.
    Click on font file amarendrasingh.com

    After clicking on font file font book will open and will display actual Font Name

    Font Book amarendrasingh.com

    Our font is Roboto and type is Thin

  3. Now we need to add font file in Project -> Target -> Copy Bundle Resources
    Adding To Bundle Resources amarendrasingh.com

    click on the “+” icon and add font file from the resulting drop down

  4. Add your font file name in info.plist -> Fonts provided by application -> item 0 (Roboto-Thin.ttf)
    Fonts Provided by Application amarendrasingh.com

    This is most overlooked and missed step 😉

  5. Now in order to see the effect make outlet of the label in ViewController named

    lblCustomFont

    Outlet amarendrasingh.com
  6. Add the custom font to your UILabel using following code.You can do it in any method
    self.lblCustomFont.font = UIFont(name:"Roboto-Thin", size: 25.0)
    

     

  7. Now run the application you will be able to see your custom font applied 🙂
    Xcode 9 Custom font amarendrasingh.com

    Using same steps you can add any number of custom fonts in your application.

A pat on the back !!