Swiftui Custom Fonts not showing

Hello, My Custom fonts are not showing in SwiftUI. I am all up to date on all of my software and I have added my TTF's to a fonts folder in my collection. I also added the "Fonts provided by application" array type to my info.plist and the fonts as elements. Here is my code. I have no idea what I'm doing wrong. Is there a bug in the latest version of Swiftui?

Code Block
Text("Hello World")
.font(.custom("VervelleScript-lgxR0", size: 36))

Did you check the correct fontname?

Did you read this? codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/#findfontname


check the postscript name. it must be like the name of the font you add

I've been wrestling with this problem for a whole day. I finally solved it by changing the key name in the info.plist from "Fonts provided by application" to "UIAppFonts". Since new projects created with SwiftUI don't include an info.plist file, I suspect that I may have imported some outdated elements from an older plist file. When I tried adding the fonts via the property list UI, it added the "Fonts provided by application" key which seems obsolete and inappropriate for my project.

Hello all! The CodeWithChris link above is helpful even if it's not directly about SwiftUIm thanks.

For me, the breakthrough was realizing that you must not include the font path in the font item, i.e. "item 0" must be "MyFont.ttf" and not "custom_fonts/MyFont.ttf" -- contrary to what various tutorials have been telling me.

Also worth noting: in XCode 15 with an iOS app under SwiftUI, actually creating an Info.plist file caused build failures that were really hard to debug. Apparently Info.plist isn't the normal way anymore, and you need to add properties in the XCode UI directly for the target.

Swiftui Custom Fonts not showing
 
 
Q