Use your Icomoon fonts with Swift - auto-generates type safe enums for each icon
- Download or clone this repo.
- Run
make
. That's it. (You can runmake uninstall
to uninstall.)
- Download your font file from Icomoon (usally called
icomoon.zip
) - Run
icomoon-swift icomoon.zip
- Add the generated
Icomoon.framework
to your Xcode project and create a copy-frameworks step in your build phases
The generated framework extends UIFont
, UIImage
and String
and generates an enum Icon
. Cases are automatically created based on the name on Icomoon. (Example: my-search
becomes .MySearch
)
import Icomoon
let searchIcon = UILabel()
searchIcon.text = String.iconWithName(.MySearch)
searchIcon.font = UIFont.iconOfSize(30)