I had a SwiftUI project that I essentially messed up pretty bad and had to make a new project and transfer all the files over. It’s working as intended except for my custom fonts aren’t working and the default font is taking over. Here is what I did:
- Copied my fonts folder into my new project
- Checked the Target Membership box for my project and made sure that the path to the directory was referring to the new path, not the old path (bc it was before I changed it).
- Included the names of both fonts in my plist, exactly how they were in the initial project’s plist, in the fonts provided by application array.
- Deleted and readded the fonts folder in my project’s Build Phases (again, to make sure it was referring to the correct directory).
And yeah, still not working. Any insight as to what I could be overlooking? Because it was working completely as intended before I had to create the new project, and all other elements are working as intended.
2
Answers
Although it looks like you have already done this, just go through the following checklist once:
If this is missing, add by clicking on the plus (+) icon in this section
If you are struggling with this in 2022 and using SwiftUI where there seems to be no info.plist in sight, then in addition to adding the Fonts capability in Target Signing and Capabilities, then dragging the file into your project and don’t forget to check Add to Targets, and finally add your InsertFontFileName.ttf to "Fonts provided by application" which is now in your Info tab on the Target as seen in the image below. Also, call me crazy but before you drag the font in remove any special characters. In addition, don’t be fooled by the auto-generated info.plist, add your new fonts via the image below, it’ll auto-populate to that other plist. Maybe some of my steps are superstitious, but I spent enough time futzing around with fonts that I’m done thinking about it and I’ll just follow my formula… and if that font doesn’t work, it wasn’t meant to be and I’ll move onto the next font!
After that