I am loading a .ttf file in the manifest like so:
Code Block .target( name: "BestPackage", dependencies: [], resources: [ .copy("Resources/Fonts/CustomFont.ttf"), .process("Resources/Colors.xcassets") ] ),
And I noticed that there's no initializer on the Font type in SwiftUI to include an asset from a module. For example, this works:
Code Block static var PrimaryButtonBackgroundColor: SwiftUI.Color { Color("Components/Button/Background", bundle: .module) }
However, there's no way to specify where a font is coming from. I was hoping that loading it into the module would emit it into the target for use, but no such luck:
Code Block static var PrimaryButtonFont: Font { Font.custom("CustomFont", size: 34) }
This does not load the font as expected. I'm investigating using a CoreText api to try and trick it into loading, but I feel like there should be an easier way. Any advice?