thii / FontAwesome.swift

Use FontAwesome in your Swift projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

atereshkov opened this issue · comments

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

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))

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

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