-2

when I use a font awesome in swift I get just question mark even when I use different hex code like f002 , f4d7 and etc in u{}.

I also add property Font provided by application in info.plist

so what's your idea to solve it. in the below photo I put every think you may need to know :

enter image description here

enter image description here

Ali kazemi
  • 84
  • 7
  • 2
    You didn't show the info plist and you didn't prove that the font is added to the target. – matt May 23 '21 at 08:26
  • 1
    @matt thank u for attention our best iOS teacher around the world , I updated and I show my info.plist – Ali kazemi May 23 '21 at 08:31

1 Answers1

1

1: check your font

for family in UIFont.familyNames {
    print("\(family)")

    for name in UIFont.fontNames(forFamilyName: family) {
        print("\(name)")
    }
}

2: maybe you have to use Hex string to text conversion - swift 3

Ten
  • 1,426
  • 1
  • 14
  • 18
  • yes it was a good idea I have a list of string fonts like , Helvetica , Times New Roman and etc but how could I recognise it is font awesome and access hexes in that? – Ali kazemi May 23 '21 at 09:50
  • does it contain your font? – Ten May 23 '21 at 10:18
  • and try it. categoryLbl.text = "\u{1F431}" – Ten May 23 '21 at 10:22
  • no it doesn't , because name of the fonts are like default font of Xcode – Ali kazemi May 23 '21 at 11:02
  • 1
    https://developer.apple.com/documentation/uikit/text_display_and_fonts/adding_a_custom_font_to_your_app read it – Ten May 23 '21 at 11:51
  • thank you brother yes I got result and also we can follow this link too : https://medium.com/@umairhassanbaig/ios-how-to-use-font-awesome-in-xcode-project-b8ef255973a3 – Ali kazemi May 24 '21 at 10:16