Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Da Costa Faro Rémy authored Aug 27, 2016
1 parent a229c4f commit b45f8a8
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,28 +101,22 @@ FAKFoundationIcons *bookmarkIcon = [FAKFoundationIcons iconWithIdentifier:@"fi-b
FAKZocial *twitterIcon = [FAKZocial iconWithIdentifier:@"zocial.twitter" size:15 error:error];
FAKIonIcons *mailIcon = [FAKIonIcons iconWithIdentifier:@"ion-ios-email" size:48 error:error];
```
```swift
let error = NSError()
let starIcon = FAKFontAwesome.starIcon(withSize: 15, error: error)
let bookmarkIcon = FAKFoundationIcons.bookmarkIcon(withSize: 15, error: error)
let twitterIcon = FAKZocial.twitterIcon(withSize: 15, error: error)
let mailIcon = FAKIonIcons.ios7EmailIcon(withSize: 48, error: error)
let starIcon: FAKFontAwesome?
do {
starIcon = try FAKFontAwesome.init(identifier: "er", size: 15)
} catch let error as NSError {
print(error.localizedDescription)
}
```

### Setting Attributes for An Icon
```objective-c
[starIcon addAttribute:NSForegroundColorAttributeName value:[UIColor
whiteColor]];
```
```swift
let starIcon: FAKFontAwesome?
do {
starIcon = try FAKFontAwesome.init(identifier: "er", size: 15)
} catch let error as NSError {
print(error.localizedDescription)
}
starIcon.addAttribute(NSForegroundColorAttributeName, UIColor.white)
```
`NSAttributedString` did all the magics behind the scene. So you can set those attributes supported by `NSAttributedString` to an icon. For all available attributes, see [NSAttributedString UIKit Additions Reference](https://developer.apple.com/library/ios/documentation/UIKit/Reference/NSAttributedString_UIKit_Additions/Reference/Reference.html#//apple_ref/doc/uid/TP40011688-CH1-SW16)

Expand Down

0 comments on commit b45f8a8

Please sign in to comment.