How do I change the font of a text/label in Xcode 15?

So I have tried adding a font, but it appears that after adding the font "Fonts provided by application" and then I couldn't choose it as a font for the text. I am using SwiftUI.

Answered by ForumsContributor in
Accepted Answer

To use your custom font you attach this modifier:

.font(.custom("exactNameOfYourFont"))

Note that the name of the font may not match the name of the file.

Thank you! However for anyone else who sees this post, to get the name of all fonts use this code:

for family in UIFont.familyNames.sorted() {
    let names = UIFont.fontNames(forFamilyName: family)
    print("Family: \(family) Font names: \(names)")
}
How do I change the font of a text/label in Xcode 15?
 
 
Q