Home / IOS Development / ios – Custom font does not appear in SwiftUI

ios – Custom font does not appear in SwiftUI



I’ve followed all the steps in Apple̵

7;s Guide to Adding Custom Fonts:

I have added the font files under a folder called fonts:

enter image description here

I have registered the scriptures by adding them Info.plist:

enter image description here

However, Xcode cannot use them / find them:

Button(action: {}){
                Text("View profile")
                    .font(Font.custom("seravekBold.tff", size: 20.0))

I have also tried to test this method:

for family in UIFont.familyNames.sorted() {
    let names = UIFont.fontNames(forFamilyName: family)
    print("Family: (family) Font names: (names)")
}

in my AppDelegate to print all the UI fonts and fonts I added (seravek) does not appear.

Any idea what the problem is?


Source link