Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding custom font to Xcode 13+

Tags:

swift

xcode13

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?

like image 288
Sergio Bost Avatar asked May 09 '26 18:05

Sergio Bost


1 Answers

  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)")
            }
        }
like image 122
user14534957 Avatar answered May 12 '26 10:05

user14534957