I use this code but icon is no displayed and it shows me like this
medicalpacakgesbutton.setTitle("\u{f0c3}", for: .normal)
You can place Font Awesome icons just about anywhere using the CSS Prefix fa and the icon's name. Font Awesome is designed to be used with inline elements (we like the <i> tag for brevity, but using a <span> is more semantically correct). icon If you change the font-size of the icon's container, the icon gets bigger.
To use the Free Font Awesome 5 icons, you can choose to download the Font Awesome library, or you can sign up for an account at Font Awesome, and get a code (called KIT CODE) to use when you add Font Awesome to your web page.
The best way to use Font Awesome in your app is FontAwesome.Swift
Example for a button icon:
button.titleLabel?.font = UIFont.fontAwesome(ofSize: 30)
button.setTitle(String.fontAwesomeIcon(name: .coffee), for: .normal)
Or for a tab bar icon:
let image = UIImage.fontAwesomeIcon(name: .coffee, textColor: UIColor.black, size: CGSize(width: 40, height: 40))
viewController.tabBarItem = UITabBarItem(title: "Coffee", image: image, tag: 1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With