I am creating a framework for iOS apps. It will contain some Label, Button, Lists, ... all as SwiftUI views, but in a special design. In the framework I've added a SwiftUI view called "ContentView" it has just the purpose of (visually) testing the UI-Elements in the canvas, later the ContentView will be deleted. I wanted to a add a custom font for the label design, I know how to do this:
- add the *.ttf file to the project
- adapt the info.plist "Fonts provided by app"
- made sure, it is listed in "Build phases" (copy bundle resources)
- use it with ".font(.custom("My-Font-Name", size: 34))"
But the custom font (that I already tried successfully in an other project, iOS application) is not shown in my ContentView. There is no compile error or any warning, the framework can be built and the ContentView is nicely rendered in the canvas. Only with the wrong font.
I tried restart Xcode, remove and add several times the font, but it didn't work. So here my questions:
- Is it possible to use a custom font within a custom framework ?
- As the custom font (*.ttf) is kind of an asset, has it to be treated different as part of a framework?
- If so, is there anything else to do (besides step 1 to 4 above mentioned) ?
Thanks for helping.