Created
Jun ’19
Replies
3
Boosts
0
Views
17k
Participants
2
Found this in docs:
.font(Font.custom("name-of-font", size: 20))
Have you got it to actually display your custom font? I'm using the following, but it's not actually displaying the custom font, either in the preview or in the simulator.
Text("Sample Text Line 1\r\nSample Text Line 2\r\nSample Text Line 3")
.font(Font.custom("Montserrat-Bold", size: 60.0))
.fontWeight(.heavy)
.color(.white)
.multilineTextAlignment(.center)
.lineLimit(0)
It displays text in the correct size and color, but using the standard font -- not Montserrat-Bold.
I tried adding the custom font files to the Assets.xcassets and just dragging the whole font folder into my project. Neither seems to work.
DOH! I'm such a noob. You still need to mark the font files as "Target Membership" and add them as "Fonts provided by application" in info.plist.