Use 1600+ icons (and more!) from FontAwesome and Google Material Icons in your swift/iOS project in an easy and space-efficient way!

Related tags

Font Swicon
Overview

Swicon

Use 1600+ icons from FontAwesome and Google Material Icons in your iOS project in an easy and space-efficient way!

The built-in icons are from

##Examples and Screenshots Swicon Screenshot

Installation

CocoaPods

To integrate FontAwesome into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'Swicon', '0.94'

Then, run the following command:

$ pod install

Manually

Copy all Swift files and ttf files into your project

Usage

  • Initialize Swicon before you use it:

    • (Recommend)In your AppDelegate, add line
    import Swicon
    .............
    Swicon.instance.loadAllAsync()

    OR

    • Before you use the icon, initialize it in sync way:
    import Swicon
    .............
    Swicon.instance.loadAllSync()
    //Now you can start using it
    Swicon.instance.getUIImage(......)

    YOU ONLY NEED TO DO THE INITIALIZATION ONCE AFTER YOUR APP STARTS

  • Get iconic string or generate an image from the icon:

    //Get NSAttributedString, the "gm-games" is the name of Google Material Design's "games" icon
    let iconicString = Swicon.instance.getNSMutableAttributedString("gm-games", fontSize: 10)
    //Set it to label, to button, or whatever place you like
    label.attributedText = iconicString
    
    //Get UIImage, "fa-heart" is the "Heart" icon from FontAwesome
    let iconicImage = Swicon.instance.getUIImage("fa-heart", iconSize: 100, iconColour: UIColor.blueColor(), imageSize:   CGSizeMake(200, 200))
    //Set it to UIImageView
    imgView.image = iconicImage

Icon Name Mapping

The built-in icons are from

  • Google Material Design Icons
    • All the Google Material Icons are prefixed with "gm-" following with the real icon names from the above link. For example, "gm-account_balance_wallet" is the name for "account_balance_wallet" icon.
  • FontAwesome
    • All the FontAwesome Icons are prefixed with "fa-" following with the icon name of FontAwesome. For example, "fa-dashcube" is the name for "dashcube" icon of FontAwesome.

And just give Swicon the icon name you want to render and Swicon will handle everything else for you.

Add Your Own Icon Fonts

Let's say you have your own icon font(which can reduce the app size compare to including the resource images for different sizes) you want to be displayed in your iOS project, you only need to:

//BEFORE you call Swicon init

//The font name prefix you want to use. For example, if you set it to "custom" and Swicon see an icon name start with "custom-", then it will know it's a custom font.
let customFontPrefix = "custom"

//Copy the ttf font file into your project and give Swicon the font file name (WITHOUT the ".ttf" extension)
let fontFileName = "custom_font" //Then Swicon will try to load the font from "custom_font.ttf" file

//The Font File Name, the fontName of your font. (The font name after you install the ttf into your system)
let fontName = "Custom"

//The icon name/value mapping dict ([FONT_NAME: FONT_UNICODE_VALUE])
let iconNameValueMappingDict = ["custom-1":"\u{f000}",...]

//Add custom font to Swicon
Swicon.instance.addCustomFont(prefix: customFontPrefix, fontFileName: fontFileName, fontName: fontName, fontIconMap: iconNameValueMappingDict)

//Then init Swicon
Swicon.instance.loadAllAsync() //Or Sync, depends on your needs

Requirements

iOS 8 or later. Swift 3 (Swift 1 can still use the version <= 0.93)

License

  • FontAwesome.ttf file licensed under SIL OFL 1.1
  • GoogleMaterialDesignIcons font file licensed under CC-BY
  • Swicon licensed under BSD
You might also like...
OpenSansSwift - Easily use the OpenSans font in Swift.
OpenSansSwift - Easily use the OpenSans font in Swift.

OpenSansSwift Easily use the OpenSans font in Swift. Why use OpenSansSwift frameworks ? The usual process of embedding any custom fonts in your IOS ap

Generator of settings icon by SF Symbols. Customisable background color and ready-use in table cell.

SPSettingsIcons Generate settings icons by Apple's SF Symbols. For safe using SFSymbols see SPSafeSymbols library. Installation Swift Package Manager

An inkwell to use custom fonts on the fly.
An inkwell to use custom fonts on the fly.

Inkwell Introduction In brief, Inkwell is a font library to use custom fonts on the fly. Inkwell takes responsibilities for: Downloading fonts from Go

Easy usage SFSymbols with static types. If symbol not available, compiler will show warning.

SPSafeSymbols Wrapper of SF Symbols. You choose the icon and what style to draw it in. You can specify the font with which to draw the icon. If the sy

Programmatically load custom fonts into your iOS and tvOS app.

FontBlaster Programmatically load custom fonts into your iOS and tvOS app. About Say goodbye to importing custom fonts via property lists as FontBlast

All the SFSymbols (1.1 & 2.0) at your fingertips

SFSymbol: SFSymbol and SFSymbol 2 All the SFSymbols at your fingertips (SFSymbol 1.1 & 2) Usage SFSymbol and SFSymbol2 are an enums that contain the i

Font Awesome swift library for iOS.
Font Awesome swift library for iOS.

Font Awesome Swift Follow me: @vaberer I like ★. Do not forget to ★ this super convenient library. Added UISegmentedControl & UITabbarItem & UISlider

Pretendard Fonts for iOS (Swift Package Manager)
Pretendard Fonts for iOS (Swift Package Manager)

PretendardKit Pretendard 1.3.3 을 기반으로 합니다. Install (Swift Package Manager) dependencies: [ .package(url: "https://github.com/wookeon/PretendardKit

Font management (System & Custom) for iOS and tvOS
Font management (System & Custom) for iOS and tvOS

UIFontComplete Font management (System & Custom) for iOS and tvOS Usage No more wasted time searching for names of UIFont fonts and no more surprises

Comments
  • Installing version 0.93 with cocapods

    Installing version 0.93 with cocapods

    Hi,

    it seams that you forgot some changes somewhere on last 0.93 version update since when I try to install it with cocoapods I get this error:

    Unable to satisfy the following requirements:

    • Swicon (= 0.93) required by Podfile

    None of your spec sources contain a spec satisfying the dependency: Swicon (= 0.93).

    You have either:

    • out-of-date source repos which you can update with pod repo update.
    • mistyped the name or version.
    • not added the source repo that hosts the Podspec to your Podfile.

    Note: as of CocoaPods 1.0, pod repo update does not happen on pod install by default.

    and when I try with version 0.91 it installs ok.

    Regards,

    Aleksandar

    opened by vualeks 2
  • clang: error: linker command failed with exit code 1 (use -v to see invocation)

    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    I get a "clang: error: linker command failed with exit code 1 (use -v to see invocation)" when i build my project with ..."pod 'Swicon', '~> 0.88'"... in my podfile.

    opened by FabianTerhorst 1
  • custom fonts with only a few glyphs wont validate

    custom fonts with only a few glyphs wont validate

    this may not be an ideal fix, but the the font works fine even though it does not pass CTFontManagerRegisterGraphicsFont validation... skipping the test for custom fonts works around the issue.

    opened by Dithers 1
Releases(0.93)
Owner
Zhibo
Zhibo
Google Material Design Icons Font for iOS

GoogleMaterialDesignIcons #Google Material Design Icons Font for iOS It is based on https://github.com/google/material-design-icons. it converts the m

Yuji Hato 365 Oct 19, 2022
Use FontAwesome in your Swift projects

FontAwesome.swift Use Font Awesome in your Swift projects To see the complete set of 3,978 icons in Font Awesome 5, please check the FontAwesome.com s

Thi Doãn 1.6k Dec 30, 2022
A better choice for iOS Developer to use FontAwesome Icon with UI.😍

FontAwesomeKit.Swift ?? ?? A better choice for iOS Developer to use FontAwesome Icon with UI. ?? Support Swift 4.2 & iOS 8.0+ FontAwesome 4.7.0 Storyb

Qiun Cheng 192 May 16, 2022
NSString+FontAwesome

FontAwesome+iOS Font awesome is an iconic font. Read more about it on http://fortawesome.github.com/Font-Awesome/ This category brings this great icon

Alex Usbergo 1.8k Nov 24, 2022
SwiftUIFontIcon The easiest way to implement font icons in your SwiftUI project.

SwiftUIFontIcon The easiest way to implement font icons in your SwiftUI project. Usage The library is super super easy to use, just something like thi

Bui Dac Huy 81 Dec 27, 2022
Icon font library for iOS. Currently supports Font-Awesome, Foundation icons, Zocial, and ionicons.

FontAwesomeKit Icon font library for iOS. Currently supports Font-Awesome, Foundation icons, Zocial, and ionicons. Version 2.2 Notable Changes Not Jus

Pride Chung 2.8k Jan 6, 2023
Icons fonts for iOS (Font Awesome 5, Iconic, Ionicon, Octicon, Themify, MapIcon, MaterialIcon, Foundation 3, Elegant Icon, Captain Icon)

Installation SPM Not yet supported. Please use Cocoapods or Carthage Carthage github "0x73/SwiftIconFont" Cocoapods CocoaPods is a dependency manager

sedat çiftçi 1.1k Dec 14, 2022
🎢 Swift Library for Font Icons

Swift Library for Font Icons Please ★ this library. Now, you don't have to download different libraries to include different font icons. This SwiftIco

Saurabh Rane 781 Dec 6, 2022
Use Ionicons in your Swift projects.

IoniconsKit IoniconsKit internally use ionicons.ttf v2.0.1 Example To run the example project, clone the repo, and run pod install from the Example di

Keita Oouchi 313 Dec 8, 2022
Use Octicons in your Swift projects.

OcticonsKit OcticonsKit internally use octicons.ttf v4.3.0 Example To run the example project, clone the repo, and run pod install from the Example di

Keita Oouchi 52 Jan 31, 2022