sgigou / NoveFeatherIcons

Feather Icons for your Swift projects.
MIT License
2 stars 1 forks source link
cocoapod feather-icons pod

NoveFeatherIcons

Version License Platform

Swift library for Feather.

For more information about Feather icons pack, please refer to their README.

Installation

NoveFeatherIcons is available through CocoaPod.

To install it, simply add the following line to your Podfile:

pod "NoveFeatherIcons", "~> 1.0"

Usage

Get an UIImage programmatically

You can get an UIImage containing the desired icon using one of the following functions:

import NoveFeatherIcons

let iconFromEnum = Feather.getIcon(.feather) // Using an enum
let iconFromString = Feather.getIcon("feather") // Using the icon’s name

If the icon is not found, those functions will return nil.

You can find the list of available icons on the official Feather website, or by looking at Feather.IconsName enum content in the Pod.

All icons contain vector data, so you can resize it as you wish. Their default size is 24×24 pixels.

Extensions & custom types

Usage of pod’s assets in Interface Builder is not allowed, as the Bundle is different.

That is why NoveFeatherIcons contains subclasses that help you integrate icons on your storyboards and XIBs. It also provides extensions to quickly init common types.

UIImageView

You can quickly init an UIImageView containing an icon using:

let image = UIImage(.feather)

In Interface Builder, you can use the FeatherImageView subclass to add an icon without code. The icon name goes in the iconName field of the Attributes inspector.

Please note that the icon will not show in IB, but will appear when running.

UIButton

In Interface builder, you can use the FeatherButton subclass to add a button containing an icon without code. The icon name goes in the iconName field of the Attributes inspector.

Please note that the icon will not show in IB, but will appear when running.

UIBarButtonItem

You can quickly init an UIBarButtonItem containing an icon using:

init(icon: Feather.IconName, style: UIBarButtonItem.Style, target: Any?, action: Selector?)

Example:

let barButtonItem = UIBarButtonItem(icon: .feather, style: .plain, target: self, action: #selector(featherButtonTapped))

In Interface Builder, you can use the FeatherBarButtonItem subclass to add an icon without code. The icon name goes in the iconName field of the Attributes inspector.

Please note that the icon will not show in IB, but will appear when running.

Requirements

Credits

Steve Gigou (Website, Twitter)

All Feather icons are made by @colebemis

License

NoveFeatherIcons is available under the MIT license. See the LICENSE file for more informations.