thii / FontAwesome.swift

Use FontAwesome in your Swift projects
MIT License
1.57k stars 266 forks source link

[iOS] Some images show question mark instead of actual icon #265

Closed atereshkov closed 3 years ago

atereshkov commented 3 years ago

Including free icons of course. I use latest v1.9 version.

// Shows "?"
tabBarItem.image = UIImage.fontAwesomeIcon(name: .home, style: .regular, textColor: .black, size: CGSize(width: 28, height: 28))

// Shows actual icon
tabBarItem.image = UIImage.fontAwesomeIcon(name: .user, style: .regular, textColor: .black, size: CGSize(width: 28, height: 28))

Any ideas?

Screen Shot 2020-11-05 at 9 05 00 PM
atereshkov commented 3 years ago

Ok seems like I get the issue. I need to check whether the icon style is free for use on the fontawesome.com.

Using .solid style for .home icon works for me:

tabBarItem.image = UIImage.fontAwesomeIcon(name: .home, style: .solid, textColor: .black, size: CGSize(width: 28, height: 28))

MatrixSenpai commented 3 years ago

Ensure that you are also using the pro fonts, if you have them available. Do this by setting FontAwesomeConfig.usesProFonts = true somewhere in your initialization. I usually set it in the AppDelegate

MatrixSenpai commented 3 years ago

I should also note that a limited number of free icons have regular styles available. Some of them only have solid. This appears to be the case with home, but not user

Each icon has a property attached that will let you know what styles are available