{"id":18683789,"url":"https://github.com/efprefix/eficonfont","last_synced_at":"2025-04-06T22:06:50.220Z","repository":{"id":35130197,"uuid":"193828480","full_name":"EFPrefix/EFIconFont","owner":"EFPrefix","description":"A better way to operate icon font in Swift, support iOS, macOS, watchOS and tvOS.","archived":false,"fork":false,"pushed_at":"2025-02-16T19:44:48.000Z","size":6987,"stargazers_count":76,"open_issues_count":0,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T23:43:53.189Z","etag":null,"topics":["font","icon","icon-font","iconfont","iconfont-icon","iconfonts"],"latest_commit_sha":null,"homepage":"https://swiftpackageindex.com/EFPrefix/EFIconFont","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EFPrefix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-26T04:17:54.000Z","updated_at":"2025-03-24T07:31:41.000Z","dependencies_parsed_at":"2025-03-16T09:17:19.839Z","dependency_job_id":null,"html_url":"https://github.com/EFPrefix/EFIconFont","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFPrefix%2FEFIconFont","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFPrefix%2FEFIconFont/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFPrefix%2FEFIconFont/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFPrefix%2FEFIconFont/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EFPrefix","download_url":"https://codeload.github.com/EFPrefix/EFIconFont/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557767,"owners_count":20958047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["font","icon","icon-font","iconfont","iconfont-icon","iconfonts"],"created_at":"2024-11-07T10:15:43.858Z","updated_at":"2025-04-06T22:06:50.203Z","avatar_url":"https://github.com/EFPrefix.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://github.com/EFPrefix/EFIconFont/blob/master/Assets/EFIconFont.png?raw=true)\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://swiftpackageindex.com/EFPrefix/EFIconFont\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/SPM-ready-orange.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://cocoapods.org/pods/EFIconFont\"\u003e\n    \t\u003cimg src=\"https://img.shields.io/cocoapods/v/EFIconFont.svg?style=flat\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://cocoapods.org/pods/EFIconFont\"\u003e\n        \u003cimg src=\"https://img.shields.io/cocoapods/p/EFIconFont.svg?style=flat\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/apple/swift\"\u003e\n    \t\u003cimg src=\"https://img.shields.io/badge/language-swift-orange.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://codebeat.co/projects/github-com-efprefix-eficonfont-master\"\u003e\n        \u003cimg src=\"https://codebeat.co/badges/4cbadc4d-e8f9-4f5b-8ee5-676ba6380383\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://raw.githubusercontent.com/EFPrefix/EFIconFont/master/LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/cocoapods/l/EFIconFont.svg?style=flat\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://app.fossa.com/projects/git%2Bgithub.com%2FEFPrefix%2FEFIconFont?ref=badge_shield\"\u003e\n        \u003cimg src=\"https://app.fossa.com/api/projects/git%2Bgithub.com%2FEFPrefix%2FEFIconFont.svg?type=shield\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nAn ordinary iconfont cocoapods package helps you to use iconfont more easily in your project, in Swift.\n\n\u003e [中文介绍](https://github.com/EFPrefix/EFIconFont/blob/master/README_CN.md)\n\n## Preview\n\n| 1 | 2 | 3 | 4 |\n|:-:|:-:|:-:|:-:|\n| ![](https://github.com/EFPrefix/EFIconFont/blob/master/Assets/1.png?raw=true) | ![](https://github.com/EFPrefix/EFIconFont/blob/master/Assets/2.png?raw=true) | ![](https://github.com/EFPrefix/EFIconFont/blob/master/Assets/3.png?raw=true) | ![](https://github.com/EFPrefix/EFIconFont/blob/master/Assets/4.png?raw=true) |\n\n## Example\n\nTo run the example project manually, clone the repo, and run `sh Startup.sh` in project folder. Demo is in the `Example` folder, open `Example.xcworkspace` with Xcode and select the target you want in it, run.\n\nOr you can run the following command in terminal:\n\n```bash\ngit clone git@github.com:EFPrefix/EFIconFont.git; cd EFIconFont; sh Startup.sh; open Example/Example.xcworkspace;\n```\n\n## Requirements\n\n- Xcode 16+\n- Swift 6.0+\n\n## Installation\n\n### CocoaPods\n\nEFIconFont is available through [CocoaPods](https://cocoapods.org). To install it, simply add the following line to your Podfile:\n\n```ruby\npod 'EFIconFont'\n```\n\nYou can get built-in iconfonts with `subspecs`, for example you will get icons of `AntDesign` and `FontAwesome` by the following way:\n\n```ruby\npod 'EFIconFont', :subspecs =\u003e ['AntDesign', 'FontAwesome']\n```\n\nYou can also choose to get all built-in packs by using `Complete` subspec:\n\n```ruby\npod 'EFIconFont', :subspecs =\u003e ['Complete']\n```\n\nThen, run the following command:\n\n```bash\npod install\n```\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the Swift compiler.\n\nOnce you have your Swift package set up, adding EFIconFont as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/EFPrefix/EFIconFont.git\", .upToNextMinor(from: \"6.0.0.0\"))\n]\n```\n\n## Use\n\n### 1. Core\n\nObjects that implement the `EFIconFontProtocol` protocol can transform themselves into `NSAttributedString` or `UIImage`, which is as follows:\n\n```swift\npublic protocol EFIconFontProtocol {\n\n    // `name` is not necessarily equal to .ttf file name\n    var name: String { get }\n\n    // `path` is path of .ttf file\n    var path: String { get }\n\n    // `attributes` is style of icon\n    var attributes: [NSAttributedString.Key : Any] { set get }\n\n    // `unicode` is unique identifier of particular icon\n    var unicode: String { get }\n    \n    // `font` is UIFont of icon with input font size\n    func font(size fontSize: CGFloat) -\u003e UIFont?\n}\n```\n\n- name: Font name, not necessarily equal to .ttf file name, you can use [BirdFont](https://birdfont.org) to see the `Name` attribute of the file;\n- path: Filepath of `.ttf` file, usually you can get it through code like `Bundle.main.path(forResource: name, ofType: \"ttf\")`(If filename is same as name, you can use the default implementation and do not need to implement this property);\n- attributes: Attributes of icon(You can use the default implementation and do not need to implement this property);\n- unicode: The unique unicode of an icon;\n- font: The `UIFont` of an icon with input font size.\n\nObjects that implement the protocol can be converted to strings and images by calling the following methods, you can also change the foreground color and size:\n\n```swift\n// MARK:- String\nfunc attributedString(size fontSize: CGFloat, attributes: [NSAttributedString.Key : Any]?) -\u003e NSAttributedString?\nfunc attributedString(size fontSize: CGFloat, foregroundColor: UIColor? = nil, backgroundColor: UIColor? = nil) -\u003e NSAttributedString?\n\n// MARK:- Image\nfunc image(size fontSize: CGFloat, attributes: [NSAttributedString.Key : Any]?) -\u003e UIImage?\nfunc image(size fontSize: CGFloat, foregroundColor: UIColor? = nil, backgroundColor: UIColor? = nil) -\u003e UIImage?\nfunc image(size imageSize: CGSize, attributes: [NSAttributedString.Key : Any]?) -\u003e UIImage?\nfunc image(size imageSize: CGSize, foregroundColor: UIColor? = nil, backgroundColor: UIColor? = nil) -\u003e UIImage?\n```\n\n### 2. Built-in iconfont packs\n\nThis pod has integrated some free resources in the subspecs, like `AntDesign` and `FontAwesome`. It can be imported by who need to use it. The usage methods are as follows, you can get a return value of `EFIconFontProtocol`:\n\n```swift\nEFIconFontAntDesign.addteam\n```\n\nYou can use the object which follow `EFIconFontProtocol` to get `NSAttributedString` and `UIImage`:\n\n```swift\nEFIconFontAntDesign.addteam.attributedString(size: 24)\nEFIconFontFontAwesomeBrands.adobe.attributedString(size: 32, foregroundColor: UIColor.white, backgroundColor: UIColor.green)\nEFIconFontFontAwesomeRegular.addressBook.image(size: 24, foregroundColor: UIColor.red)\nEFIconFontFontAwesomeSolid.alignLeft.image(size: CGSize(width: 36, height: 48), foregroundColor: UIColor.white)\n```\n\nYou can also get all icons of a `EFIconFontCaseIterableProtocol` object with type `[String : EFIconFontProtocol]` by the following code:\n\n```swift\nEFIconFont.antDesign.dictionary\n```\n\nPS: Although the libraries below are all free, please make sure that your way of using the icon conforms to the original author's protocol specification:\n\n| Name | Version | Count | File Size | Description | License | Preview |\n|:-|:-|:-|:-|:-|:-|:-|\n| AliCloudConsole | 1.0 | 266 | 42KB | AliCloudConsole | Unknown | [iconfont.cn](https://www.iconfont.cn/collections/detail?cid=11607) |\n| AntChain | 1.0 | 77 | 17KB | AntChain | Unknown | [iconfont.cn](https://www.iconfont.cn/collections/detail?cid=26815) |\n| AntDesign | 1.0 | 557 | 127KB | Ant Design | [MIT](https://github.com/ant-design/ant-design/blob/master/LICENSE) | [iconfont.cn](https://www.iconfont.cn/collections/detail?cid=9402) |\n| Dashicons  | 0.9.0 | 203 | 51 KB | Official icon font of the WordPress admin | [GPLv2](https://github.com/WordPress/dashicons) | [wordpress.org](https://developer.wordpress.org/resource/dashicons) |\n| Devicons | 1.8.0 | 192 | 92KB | An iconic font for developers | [MIT](https://github.com/vorillaz/devicons) | [vorillaz.github.io/devicons](http://vorillaz.github.io/devicons/#/cheat) |\n| ElusiveIcons | 2.0.0 | 304 | 53KB | Elusive Icons | [OFL](http://elusiveicons.com/license/) | [elusiveicons.com](http://elusiveicons.com/icons/) |\n| EVAIcon |  | 21 | 45 KB | EVA | [OFL](https://github.com/moeoverflow/EVA-icon) | [EVA-icon](https://moeoverflow.github.io/EVA-icon/) |\n| EvilIcons | 1.10.1 | 70 | 16 KB | Simple and clean SVG icon pack | [MIT](https://github.com/evil-icons/evil-icons/blob/master/LICENSE.txt) | [evil-icons.io](https://evil-icons.io/) |    \n| FontAwesom(Regular / Brands / Solid) | 5.8.1 | 1516 | 356KB | Font Awesome | [Font Awesome Free License](https://fontawesome.com/license/free) | [fontawesome.com](https://fontawesome.com/icons?d=gallery\u0026m=free) |\n| FoundationIcons | 3.0 | 283 | 68KB | Foundation Icon Fonts 3 | [-](https://github.com/zurb/foundation-icon-fonts) | [zurb.com/playground/foundation-icon-fonts-3](https://zurb.com/playground/foundation-icon-fonts-3) |\n| Genericons | 4.0.4 | 103 | 16KB | Genericons Neue are generic looking icons, suitable for a blog or simple website | [GPLv2](https://github.com/Automattic/genericons-neue/blob/master/COPYING.md) | [genericons.com](http://genericons.com/) |\n| Hawcons | 1.0 | 1035 | 685KB | Hawcons, includes icons of Documents, Sports, Weather, Emoji, Gestures, Filetypes, etc. | [Free](http://hawcons.com/faq/) | [hawcons.com](http://hawcons.com/preview/) |\n| IcoMoon | 1.0 | 490 | 94KB | IcoMoon free icons | [CC BY 4.0 / GPL](https://github.com/Keyamoon/IcoMoon-Free/blob/master/License.txt) | [ionicons.com](https://icomoon.io/#preview-free) |\n| Ionicons | 4.5.5 | 696 | 143KB | Ionicons | [MIT](https://github.com/ionic-team/ionicons/blob/master/LICENSE) | [ionicons.com](https://ionicons.com/) |\n| LigatureSymbols | 2.11 | 239 | 84KB | Ligature Symbols | [OFL](http://kudakurage.com/ligature_symbols/)| [kudakurage.com/ligature_symbols](http://kudakurage.com/ligature_symbols/) |\n| MapIcons | 3.0.0 | 192 | 48 KB | A set of icons for use with maps | [OFL](https://github.com/scottdejonge/map-icons) | [map-icons.com](http://map-icons.com/) | \n| MaterialIcons | 3.0.1 | 1057 | 695KB | Google's material design icons, four styles | [Apache-2.0](https://github.com/google/material-design-icons/blob/master/LICENSE) | [material.io](https://material.io/tools/icons) |\n| Meteocons |  | 47 | 15KB | A set of weather icons, it containing 40+ icons | [Free](https://www.alessioatzeni.com/meteocons/) | [alessioatzeni.com/meteocons](https://www.alessioatzeni.com/meteocons/) |\n| MetrizeIcons | 1.0 | 300 | 74KB | Free Collection of 300 Metro-Style Icons for Designers and Developers | [Free](https://www.alessioatzeni.com/metrize-icons/) | [alessioatzeni.com/metrize-icons](https://www.alessioatzeni.com/metrize-icons/) |\n| OpenIconic | 1.1.1 | 223 | 33KB | An open source icon set with 223 marks in SVG | [OFL](https://github.com/iconic/open-iconic/blob/master/FONT-LICENSE) | [useiconic.com/open](https://useiconic.com/open/) |\n| StrawberryIcon | 2.0.0 | 382 | 69KB | A Free And Open Iconic Font Library for Developer and Creator | [OFL](https://github.com/xiangsudian/CaoMei) | [chuangzaoshi.com/icon](http://chuangzaoshi.com/icon/) |\n| Stroke7 | 1.2.0 | 202 | 44KB | A series of iOS 7 inspired thin stroke icons | [Free](https://www.pixeden.com/icon-fonts/filled-7-icon-font-set) | [themes-pixeden.com/font-demos](http://themes-pixeden.com/font-demos/7-stroke/index.html) |\n| TaoBao | 1.0 | 434 | 126KB | TaoBao | Unknown | [iconfont.cn](https://www.iconfont.cn/collections/detail?cid=33) |\n| ThemifyIcons | 1.0 | 352 | 68KB | A complete set of icons for use in web design and apps | [Free](https://themify.me/themify-icons) | [themify.me](https://themify.me/themify-icons) |\n| Tmall | 1.0 | 564 | 190KB | Tmall | Unknown | [iconfont.cn](https://www.iconfont.cn/collections/detail?cid=28) |\n| Typicons | 2.0.9 | 336 | 82KB | 336 pixel perfect, all-purpose vector icons in a kit | [OFL](https://github.com/stephenhutchings/typicons.font/blob/master/README.md) | [s-ings.com/typicons](https://www.s-ings.com/typicons/) |\n| VSCodeIcons | 1.0 | 133 | 24KB | Icons for Visual Studio Code | [MIT](https://github.com/microsoft/vscode-icons/blob/master/LICENSE-CODE) | [github.com/microsoft/vscode-icons](https://github.com/microsoft/vscode-icons) |\n| WeatherIcons | 2.0.10 | 219 | 64KB | Weather, maritime, and meteorological based icons | [OFL](https://github.com/erikflowers/weather-icons) | [erikflowers.github.io/weather-icons](http://erikflowers.github.io/weather-icons/) |\n| Zocial | 1.3.0 | 112 | 31KB | Popular social icons | [MIT](https://github.com/smcllns/css-social-buttons/blob/master/LICENSE) | [smcllns.github.io/css-social-buttons/](https://smcllns.github.io/css-social-buttons/) |\n\n### 3. Extend custom packs\n\n#### (1) Import Font File\n\nDrag the `.ttf` file of the icon library into the Xcode project and ensure that the `Copy Bundle Resources` list in `Build Phases` contains this font file (It will be included by default, just check it).\n\nIn addition, the file will be loaded at runtime, do not need to add it to the `Fonts provided by application` item in the `Info.plist` file.\n\n#### (2) Implement `EFIconFontCaseIterableProtocol` \n\nBy making a implementation of [EFIconFontCaseIterableProtocol](https://github.com/EFPrefix/EFIconFont/blob/master/EFIconFont/Classes/Core/EFIconFontCaseIterableProtocol.swift) you can get your custom iconfont pack object, demo in this project demonstrates customization with GitHub's Octicons as an [example](https://github.com/EFPrefix/EFIconFont/blob/master/Example/EFIconFont-iOS/Octicons/EFIconFontOcticons.swift):\n\n```swift\nimport EFIconFont\n\npublic extension EFIconFont {\n    public static let octicons = EFIconFontOcticons.self\n}\n\nextension EFIconFontOcticons: EFIconFontCaseIterableProtocol {\n    public static var name: String {\n        return \"octicons\"\n    }\n    public var unicode: String {\n        return self.rawValue\n    }\n}\n\npublic enum EFIconFontOcticons: String {\n    case thumbsup = \"\\u{e6d7}\"\n    case unverified = \"\\u{e6d6}\"\n    case unfold = \"\\u{e6d5}\"\n    case verified = \"\\u{e6d4}\"\n    // ...\n}\n```\n\n#### (3) Call\n\nSame as `Built-in iconfont packs` above:\n\n```swift\nEFIconFontOcticons.thumbsup\n```\n\n#### (4) Attention\n\nThe `Octicons` icon library in this project is owned by GitHub. This is only a demonstration, do not use it in any situation that violates the specifications set by its owner:\n\n| Name | Version | Count | File Size | Description | License | Preview |\n|:-|:-|:-|:-|:-|:-|:-|\n| Octicons | 8.4.2 | 184 | 34KB | GitHub‘s icons | [GitHub Logos and Usage](https://github.com/logos) | [octicons.github.com](https://octicons.github.com/) |\n\n### 4. Other\n\nUsage of some iconfont resource sites:\n\n- [iconfont.cn](https://github.com/EFPrefix/EFIconFont/blob/master/Extend/iconfont.md)\n- [fontawesome.com](https://github.com/EFPrefix/EFIconFont/blob/master/Extend/fontawesome.md)\n- [material.io/icons/](https://github.com/EFPrefix/EFIconFont/blob/master/Extend/materialicons.md)\n\n## Author\n\nEyreFree, eyrefree@eyrefree.org\n\n## License\n\n\u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/License_icon-mit-88x31-2.svg/128px-License_icon-mit-88x31-2.svg.png\"\u003e\n\nEFIconFont is available under the MIT license. See the [LICENSE](LICENSE) file for more info.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefprefix%2Feficonfont","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fefprefix%2Feficonfont","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefprefix%2Feficonfont/lists"}