8

Now that Apple has taken away the Plist, naturally it has changed the way we add custom fonts to our app. Before we just added the file to our bundle and set a property for it and our plist and viola..

Now I am curious.. can it be done without adding a custom plist as shown here or is that the only option?

Sergio Bost
  • 2,591
  • 2
  • 11
  • 29

2 Answers2

16
  1. drag and drop your font-file into the project (make sure you hit copy if needed and check the target box)

drag&drop

  1. choose Project -> Targets -> Info -> Custom iOS Target Properties and klick the small + icon under the "key" property. Start typing "Fonts provided by application"

enter image description here

  1. enter the full font-filename inside this property-list

enter image description here

  1. now you can use the font by its name

  2. (Bonus: if you have trouble to find the font name, you can print all available fonts with [see detail explanation for this at code with chris ]:

 for family: String in UIFont.familyNames
        {
            print(family)
            for names: String in UIFont.fontNames(forFamilyName: family)
            {
                print("== \(names)")
            }
        }
user14534957
  • 336
  • 3
  • 10
3

You can add font files name same as you add in project directory info.plist

Just go to

Project -> Targets -> Info -> Custom iOS Target Properties

Add your all permission or file here.

enter image description here

Raja Kishan
  • 16,767
  • 2
  • 26
  • 52