Use Font Awesome in project written in Swift.

Related tags

Font Font-Awesome
Overview

Font-Awesome license

Use Font Awesome in project written in Swift. If you hope to use lastest edition, it is possible by Font-Awesome.

Font-Awesome supports the input with Unicode.

Requirements

  • iOS 7.0+
  • Xcode 6.1

Installation

  1. Copy Font-Awesome directory into your project
  2. Download zip file from https://fortawesome.github.io/Font-Awesome/
  3. Copy FontAwesome.otf from zip file into your project
  4. Check to import FontAwesome.otf in project, "Project" > "Target" > "Copy Bundle Resources"

Features

  • Support Unicode from String or Int. not use UInt
  • Support extension UIButton.
  • Support extension UIBarButtonItem
  • Support extension UIImageView
  • Support Cocoapods

Usage

  1. Set UIFont with size
let font = UIFont.fontAwesome(size: 40)
  1. Set String with Unicode

Use String or Int

extension String {
  static func fontAwesome(unicode fontAwesome: UnicodeLiteralConvertible) -> String
}

String.fontAwesome(unicode: 0xf092) // Int
String.fontAwesome(unicode: "f092") // String

Example

  • Use extension
// UIButton
let button = UIButton(frame: frame)
button.setTitleColor(UIColor.blueColor(), forState: .Normal)
button.setFontAwesome(fontAwesome: "f081", forState: .Normal)

// UIBarButtonItem
let barButtonItem = UIBarButtonItem(fontAwesome: "f002", target: nil, action: nil) // f002 = fa-search
navigationItem.rightBarButtonItem = barButtonItem

// UILabel
let label = UILabel(frame: frame)
label.font = UIFont.fontAwesome(size: 40)
label.text = String.fontAwesome(unicode: 0xf092) // f092 = fa-github-square

// UIImageView
let imageView = UIImageView(frame: frame)
imageView.fontAwesome(fontAwesome: "f087")

LICENSE

Font-Awesome is available under the MIT license.

Credit

Font Awesome

The Font Awesome webfont, CSS, and LESS files are licensed under CC BY 3.0. A mention of Font Awesome - http://fortawesome.github.com/Font-Awesome in human-readable source code is considered acceptable attribution (most common on the web). If human readable source code is not available to the end user, a mention in an 'About' or 'Credits' screen is considered acceptable (most common in desktop or mobile software).

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

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

Use FontAwesome in your Swift projects
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

Use Ionicons in your Swift projects.
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

Use Octicons in your Swift projects.
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

Google Material Design Icons for Swift and ObjC project
Google Material Design Icons for Swift and ObjC project

GoogleMaterialIconFont Google Material Design Icons for Swift and ObjC project This library is inspired by FontAwesome.swift Both Swift and Objctive-C

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

A better choice for iOS Developer to use FontAwesome Icon with UI.๐Ÿ˜
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

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

round icon drag control (made in swift) dock style
round icon drag control (made in swift) dock style

ASBubbleDrag Bubble drag control integrate in storyboard : Installation CocoaPods You can use CocoaPods to install ASBubbleDrag by adding it to your P

Comments
  • Application not finding the font in the system

    Application not finding the font in the system

    I added the Font-Awesome.swift - Looking at the code, it's not able to get the contents of the file. I also tried using the get contents of file but data is always coming as nil.

    I also added the font to the info.plist but no luck. Am i missing anything. I tried with .ttf as well as .otf with no luck.

    class FontManager {
            class func load(fontName: String) {
                if (UIFont.fontNamesForFamilyName(fontName).count > 0) {
                    return
                }
    
                let fontURL = NSBundle.mainBundle().URLForResource(fontName, withExtension: "otf")
                **let data = NSData(contentsOfURL: fontURL!)!**
    
                let provider = CGDataProviderCreateWithCFData(data)
                let font = CGFontCreateWithDataProvider(provider)!
    
                var error: Unmanaged<CFError>?
                if !CTFontManagerRegisterGraphicsFont(font, &error) {
                    println(error)
                }
            }
        }
    
    opened by abhaytalreja 3
  • 'UIFont.Type' does not have a member named 'fontAwesome'

    'UIFont.Type' does not have a member named 'fontAwesome'

    I copied both the Font-Awesome folder and the FontAwesome.swift to the projects folder but when i tried to use one of the example I received the above error. This is the example: let label = UILabel(frame: frame) label.font = UIFont.fontAwesome(size: 40) label.text = String.fontAwesome(unicode: 0xf092) // f092 = fa-github-square

    I tried it on others with the same error.

    opened by wstudios 1
Owner
Hirohisa Kawasaki
Hirohisa Kawasaki
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

Patrick Vaberer 746 Dec 17, 2022
Font Awesome support in Swift

MCFontAwesome Font Awesome v4.1.0 for Swift Font aliases has not been ported yet, in order to refer to a font you have to strip all the - (minus) insi

Matteo Crippa 19 Jun 9, 2020
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
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

Hemant Sapkota 42 Jan 29, 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
๐ŸŽข 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
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

Nicholas Maccharoli 1.3k Nov 14, 2022
Auto-generated icon font library for iOS, watchOS and tvOS

Iconic helps making icon fonts integration effortless on iOS, tvOS and watchOS. Its main component is in charge of auto-generating strongly typed Swif

Home Assistant 1.6k Nov 12, 2022
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
This projects shows how we can server-side add/update "ANY" custom font in a live iOS App without needing to update the app.

Server-side-Dynamic-Fonts This projects shows how we can server-side add/update "ANY" custom font in a live iOS App without needing to update the app.

null 2 Mar 26, 2022