Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iconWithIdentifier with swift #84

Open
jpodcedensek opened this issue Mar 14, 2016 · 2 comments
Open

iconWithIdentifier with swift #84

jpodcedensek opened this issue Mar 14, 2016 · 2 comments

Comments

@jpodcedensek
Copy link

Hi, is there a way to use iconWithIdentifier in Swift code?

@hebbian
Copy link

hebbian commented Mar 19, 2016

No, there isn't last time I checked on latest installation from pod

@jpodcedensek
Copy link
Author

I solved that in a dirty way with

let iconIdentifier = "iconId"
if iconIdentifier.containsString("fa-"){
    let iconCodes = FAKFontAwesome.allIcons() as NSDictionary
    if iconCodes.allKeysForObject(iconIdentifier.stringByReplacingOccurrencesOfString("fa-", withString: "")).count > 0{
        if let iconCode = iconCodes.allKeysForObject(iconIdentifier.stringByReplacingOccurrencesOfString("fa-", withString: ""))[0] as? String{
            iconLabel.attributedText = FAKFontAwesome(code: iconCode, size: 40).attributedString()
        }
    } else {
        print("Can't find FontAwesome icon for identifier ", iconIdentifier)
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants