how to add custom icons using fontAwesome to UIbutton in swift 4

how to use font awesome icons in swift
font awesome ios icon
add icon in button swift
font awesome solid icons
status icon font awesome
font awesome chat icon
font awesome weather icons
start icon font awesome

I am currently working on an IOS application and i want to add button labels or icon using FontAwesome i have successfully installed cocoapods in my project and now i have no idea of using cocoapods for adding library FontAwesome(More info:-enter link description here) icons in my IOS Application.

  • I need to know about the procedure of adding FontAwesome using cocoapods, and
  • I need to know if their is another way to add FontAwesome to my project

thanks

Use like below:-

Step1 : Add framework like below image

Step 2:Drag and drop all .otf and .swift files into your project Step 3:import FontAwesome_swift Step 4: Use below code:-

let imageView  = UIImageView(frame: CGRect(x: 80.0, y: 80.0, width: 50, height: 50))
imageView.image = UIImage.fontAwesomeIcon(name: .github, style: .brands, textColor: .black, size: CGSize(width:40,height:40))
self.view.addSubview(imageView) 

Result:-

I am currently working on an IOS application and i want to add button labels or icon using FontAwesome i have successfully installed  iOS 8.3+ Swift 1.2 Font Awesome 4.3.0+ How to create fancy pants buttons. In this tutorial we’ll create UIButtons that display an icon with a text description below. Achieving this is NOT

In this tutorial we'll create UIButtons that display an icon with a text description below. Achieving this is NOT difficult, Follow. Apr 29, 2015 · 7 min read. iOS 8.3​+. Swift 1.2. Font Awesome 4.3.0+ The key functional capabilities we're aiming for are: Customised I'm sure you'll be able to create the extra 2 on your own. Since you're not using the titleLabel here, you can just optionally use it and if it's nil it will just be a no-op. I'll also add as other people are saying, the font property is deprecated, and make sure to use setTitle:forControlState: when setting the title text.

If you have not already installed CocoaPods, these are good instructions: https://stackoverflow.com/a/25257238/8534588

Install FontAwesome with CocoaPods:
  1. Open up Podfile which is in the same folder as your .xcodeproj file
  2. Add this line to Podfile to install FontAwesome.swift: pod 'FontAwesome.swift'
  3. Save changes to Podfile
  4. Open up Terminal in the folder that contains Podfile and run the command pod install
How to use FontAwesome icons:

Add import FontAwesome_swift in your code file

Example code:

let image = UIImage.fontAwesomeIcon(name: .checkCircle, style: .solid, textColor: UIColor.black, size: CGSize(width: 40, height: 40))

how to add custom icons using fontAwesome to UIbutton in swift 4 - I am currently working on an IOS application and i want to add button labels  Try https://icomoon.io/ - you can add FontAwesome (along with other librariest out there, similar to icnfnt.com) and then add your own custome SVGs and export them all as a single font.

I have done this in Objective C, So hope this would be useful. The procedure will be same but you need to convert the Objective C code to Swift.

So for do this in Objective C, You can follow the step mentioned in this link to add the FontAwesome manually to your project without using CocoaPod, If you are interested not to use CocoaPod

Manually Add FontAwesome

From that Github project takeout the NSString category class, i.e NSString+FontAwesome

You need to add the fontawesome-webfont.ttf in resource folder as well

NB: For me error was coming after I add NSString Category class mentioned there in the above link, If you are facing the issue like duplicate definition then just rename those enum constants those are not satisfying the variable naming convention. (For me some of the enum constant were using hypen(-) i replaced those with underscore(_)).

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 site. In your UILabel, UIButton or UITextField, set a text containing a placeholder anywhere you want the icon to be. Somethink like this. oc:logo-github. Then you can choose between 3 ways you can use SwiftIconFont. 1. Without Custom Class. Simply import SwiftIconFont and call processIcons on any UILabel, UIButton or UITextField that has a placeholder.

Icons fonts for iOS (FontAwesome, Iconic, Ionicon, Octicon, Themify, MapIcon, install hang Opened by purkylin about 1 year ago #91 No support with Swift 4.2  Font Awesome icons is a great way to show icons in your html page. It's easy, fast and free. Yeah! It's free. Who doesn't like free stuff, eh? Here, I am going to show how to install and use font-awesome in your html page. But, just before that, you might wanna ask- (Disclaimer- This post contains affiliate links.) What is Font Awesome?

Dec 06, 2016 · Tutorial: Make a Custom UIButton in Swift 3! Set 27 Comments on “ How to Use Jul 28, 2016 · xcode text field tutorial for ios Is there any way without setting the image or without fontAwesome icon to set icon on the Sep 17,​  This tutorial shows you how to add Font Awesome icons to your Bootstrap page and create social media icons in your navigation. It also shows how to add a custom.css to help customize the site.

A better choice for iOS developer to use FontAwesome Icon with UI. Show Apps using FontAwesomeKit.Swift let button = UIButton(type: .custom) button. Welcome to UIButtons Trick! Learn the easy way to Add Border , Shadow , Image Icon to Button and change Color in Xcode by Swift Program ( Custom UIButtons ) You will be using @ UIButtons @UIColor

Comments
  • Hi, Firstly i want to thank you for answering my question. And Secondly i want to thank you again because i followed your instructions and got my desire result.
  • @hussnainahmad you are welcome and you feel free to upvote :D Happy coding.