Skip to content

Commit

Permalink
some fixes to the examples in the README (#122)
Browse files Browse the repository at this point in the history
* changed to swift3 syntax

examples of old vs new syntax:

UIFont.fontAwesomeOfSize(100)
UIFont.fontAwesome(size: 100)

String.fontAwesomeWithName(FontAwesome.Github)
String.fontAwesome(name: FontAwesome.Github)

String.fontAwesomeWithCode("fa-github")
String.fontAwesome(code: "fa-github")

UIImage.fontAwesomeIconWithName(FontAwesome.Github, textColor: UIColor.blue, size: CGSize(width: 4000, height: 4000), backgroundColor: UIColor.red)
UIImage.fontAwesomeIcon(name: FontAwesome.Github, textColor: UIColor.blue, size: CGSize(width: 4000, height: 4000), backgroundColor: UIColor.red)

UIImage.fontAwesomeIconWithCode("fa-github", textColor: UIColor.blue, size: CGSize(width: 4000, height: 4000), backgroundColor: UIColor.red)
UIImage.fontAwesomeIcon(code: "fa-github", textColor: UIColor.blue, size: CGSize(width: 4000, height: 4000), backgroundColor: UIColor.red)

* fixed tabs to be 4 spaces...

* changed UIFont.fontAwesome to use ofSize parameter

This is more consistent with the UIFont API; like in UIFont.boldSystemFont(ofSize: 200)

* changed to lowerCamelCase for enum values

* fixes to the examples in README... ;)
  • Loading branch information
doedje authored and thii committed Oct 24, 2016
1 parent 596aca1 commit 9ca8cc1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ button.setTitle(String.fontAwesomeIcon(name: .github), for: .normal)
### FontAwesome icon as navigation bar item
```swift
let attributes = [NSFontAttributeName: UIFont.fontAwesomeOfSize(20)] as [String: Any]
leftBarButton.setTitleTextAttributes(attributes, forState: .normal)
leftBarButton.title = String.fontAwesomeIconWithName(.github)
leftBarButton.setTitleTextAttributes(attributes, for: .normal)
leftBarButton.title = String.fontAwesomeIcon(name: .github)
```

### FontAwesome icon as toolbar item
```swift
let attributes = [NSFontAttributeName: UIFont.fontAwesome(ofSize: 20)] as [String: Any]
toolbarItem.setTitleTextAttributes(attributes, forState: .normal)
toolbarItem.title = String.fontAwesomeIconWithName(.github)
toolbarItem.setTitleTextAttributes(attributes, for: .normal)
toolbarItem.title = String.fontAwesomeIcon(name: .github)
```

### FontAwesome icon as an image
Expand All @@ -86,7 +86,7 @@ tabBarItem.image = UIImage.fontAwesomeIcon(name: .github, textColor: UIColor.bla

### FontAwesome icon as an image with background color
```swift
tabBarItem.image = UIImage.fontAwesomeIcon(name: FontAwesome.github, textColor: UIColor.blue, size: CGSize(width: 4000, height: 4000), backgroundColor: UIColor.red)
tabBarItem.image = UIImage.fontAwesomeIcon(name: .github, textColor: UIColor.blue, size: CGSize(width: 4000, height: 4000), backgroundColor: UIColor.red)
```

## Requirements
Expand Down

0 comments on commit 9ca8cc1

Please sign in to comment.