1

I have downloaded a couple of .TTF's and added them as resources. Then added the "Fonts provided by application" array type key to the info.plist, then added the font names as elements. However, The fonts are not showing up in the app. Below is my code. Am I doing something wrong?

struct ContentView: View { 
     var body: some View { 
         Text("Hello World").font(.custom("DaddyRewind", size: 36)) 
     }
 }
koen
  • 5,383
  • 7
  • 50
  • 89
Grepler
  • 13
  • 4
  • I had the same problem because I was uploading the folder with fonts file in it. What I did was adding all the fonts and collect them later with a group folder. The problem was that adding fonts already inside a folder doesn’t make a copy on Bundle resources – xmetal Aug 31 '20 at 18:02

1 Answers1

1

Add Your Fonts enter image description here

Add Your Fonts to the Info.plist enter image description here

Then

.font(.custom("Your-Font-Name", size: 48))
Joannes
  • 2,569
  • 3
  • 17
  • 39
  • Thanks for your response. The only difference between what you have suggested and what I have already done is that you put you fonts in a "Fonts" folder, where I put mine in a "Resources" folder. Do you think that makes a difference? – Grepler Aug 31 '20 at 14:55
  • @Grepler it should be the same – Joannes Aug 31 '20 at 15:25
  • OK, I changed my config to replicate yours and my custom fonts still are not showing. Any other suggestions? – Grepler Sep 01 '20 at 01:30
  • have you set the right font names (casesensetive) in Info.plist and the right key **Fonts provided by application**? – Joannes Sep 01 '20 at 08:51
  • Yes. Everything is exactly the same as your config. Spelling is correct. – Grepler Sep 04 '20 at 01:05
  • Follow [this](https://medium.com/better-programming/swiftui-basics-importing-custom-fonts-b6396d17424d) – Joannes Sep 04 '20 at 11:55
  • New development. If I use one of the native custom fonts like Georgia or Verdana it works fine. But if I import TTF’s the system is buggy at best. Sometimes they work, somwtimes they do not. – Grepler Sep 05 '20 at 15:30