I want to use custom fonts(external fonts) to my project programmatically.
- I added fonts to my project folder.
- Recorded imported fonts to the info.plist
- Copy that font file to the BuildPhases->Copy Bundle Resources
- The fonts appear in Attributes Inspector
But when I implement this code to get custom font names, a lot of fonts appear but my custom fonts do not appear on the console.
for the family: String in UIFont.familyNames
{
print(family)
for names: String in UIFont.fontNames(forFamilyName: family)
{
print("== \(names)")
}
}
So as mentioned below, When I implemented attributed string in my project programmatically,
let att1 = [NSAttributedString.Key.font : UIFont(name: "Sofia Pro", size: 18.0)]
It crashed and say unrecognized selector sent to instance
Did I skip any step?