Skip to content
A better choice for iOS Developer to use FontAwesome Icon with UI.😍
Swift Python Objective-C Ruby
Branch: master
Clone or download
qiuncheng Merge pull request #9 from ubunfork/master
删除设置图标时修改图标大小的逻辑
Latest commit ab2e69f Jun 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example Update example Mar 26, 2019
FontAwesomeKit.xcodeproj Update to swift5 Mar 27, 2019
FontAwesomeKit 修改给button setTitle时的值为原来的值 Jun 15, 2019
FontAwesomeKitTests Update tests Feb 14, 2019
Py update README.md Oct 18, 2016
Screenshots update for release 0.2.0 Nov 7, 2016
.gitignore
.swift-version Update pods Mar 27, 2019
CNAME Update CNAME Jun 18, 2018
FontAwesomeKit.Swift.podspec Update pods Mar 27, 2019
LICENSE Initial commit Oct 16, 2016
README.md Update for 1.0.1 & Fixed #8 Mar 25, 2019
_config.yml Set theme jekyll-theme-minimal Jun 12, 2018

README.md

FontAwesomeKit.Swift

😀😘A better choice for iOS Developer to use FontAwesome Icon with UI.😍
GitHub license

FontAwesome.otf 4.7.0

Support

Swift 4.2 & iOS 8.0+
FontAwesome 4.7.0
Storyboard supported.

Installation

CocoaPods

  1. add pod 'FontAwesomeKit.Swift' to your Podfile.
  2. Run pod install OR pod update.
  3. import FontAwesomeKit_Swift

Manually

  1. Download the full file.
  2. Drag the FontAwesomeKit folder to your project.

Example

Use FontAwesomeKit.Swift in Storyboard.

  1. Set Custom class to FontAwesomeButton or FontAwesomeLabel
  2. Set unicode string in Attributes inspector for FontAwesomeLabel or set normal, highlighted, selected, disabled unicode string for FontAwesomeButton, such as f107 or 0xf107
    // All awesome unicode --> http://fontawesome.io/cheatsheet/

FontAwesomeKit.Swift For Storyboard

Use FontAwesomeKit.Swift with String.

let str1 = String.fontAwesome(undefined: 0xf107)
let str2 = String.fontAwesome(awesomeType: .github)
let attrs = [NSFontAttributeName: UIFont(fontSize: 32)]
let attrStr1 = NSAttributedString(string: str1)
let attrStr2 = NSAttributedString(string: str2)

The attrStr1 will get icon. The attrStr2 will get icon.

Use FontAwesomeKit.Swift with UILabel.

let label = UILabel()
label.text = .apple
label.font = UIFont(fontSize: 100)
/// text : FontAwesomeType.

Use FontAwesomeKit.Swift with UIButton.

let button = UIButton(type: .custom)
button.setTitle(.gift, for: .normal)
/// type : The fontAwesome type, and you don’t need to ‘setImage’ or ‘setBackgroundImage’
/// state : The state that uses the specified title. The possible values are described in UIControlState.
button.titleLabel?.font = UIFont(fontSize: 50)

Use FontAwesomeKit.Swift with UIImage.

let image1 = UIImage(awesomeType: .github)
/// fontSize : The fontSize you can give, default is 80.
/// tintColor : The UIImage filled color you get, default is UIColor.lightGray.
let image2 = UIImage(awesomeType: .github, size: 30.0, color: UIColor.black)

Use FontAwesomeKit.Swift with UINavigationBarItem.

let rightItem = UIBarButtonItem(awesomeType: .github, style: .plain, target: nil, action: nil)
let leftItem = UIBarButtonItem(awesomeType: .github, size: 24, style: .plain, target: nil, action: nil)
/// fontSize : The font size, default is ‘24.0’
/// awesomeType : FontAwsomeType

LICENCE

Under MIT License

Thanks

  1. The FontAwesome Unicode list. From fontawesome.io
  2. The Lastest(version4.7.0) FontAwesome.otf bundle
You can’t perform that action at this time.