Skip to content

Commit

Permalink
Merge pull request #10 from nitrag/improve-readme
Browse files Browse the repository at this point in the history
Improve Readme
  • Loading branch information
schickling authored Jul 28, 2017
2 parents 23bda78 + 895cd88 commit 9e883c2
Showing 1 changed file with 42 additions and 14 deletions.
56 changes: 42 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,66 @@
# Icomoon.swift
Use your **Icomoon fonts with Swift** - auto-generates type safe enums for each icon
Use your **[Icomoon](https://icomoon.io/) fonts with Swift** - auto-generates type safe enums for each icon

## Usage

### API

The generated framework extends `UIFont`, `UIImage` and `String` and generates an `enum Icon`. Cases are automatically created based on the name on Icomoon. (Example: `my-search` becomes `.MySearch`)

```swift
import Icomoon

//UILabel
searchIcon.text = String.iconWithName(.MySearch)
searchIcon.font = UIFont.iconOfSize(30)

//UIButton
buttonChat.titleLabel?.font = UIFont.iconOfSize(30)
buttonChat.setTitle(String.iconWithName(.Chat), for: .normal)

//UIImage
myImage.image = UIImage.icomoonIcon(name: .Chat, textColor: UIColor.black, size: CGSize(width:myImage.frame.width, height:myImage.frame.height))
```
## Installation

### Download and Make

1. [Download](https://github.com/optonaut/Icomoon.swift/archive/master.zip) or clone this repo.
2. Run `make`. That's it. (You can run `make uninstall` to uninstall.)

## Usage

### Generate framework

![](https://raw.githubusercontent.com/optonaut/Icomoon.swift/master/resources/readme.png)

1. Download your font file from Icomoon (usally called `icomoon.zip`)
2. Run `icomoon-swift icomoon.zip`
3. Add the generated `Icomoon.framework` to your Xcode project and create a [copy-frameworks](https://github.com/Carthage/Carthage#if-youre-building-for-ios) step in your build phases
3. Add the generated `Icomoon.framework` to your Xcode project by following the import instructions below.

### API
### Import Framework

The generated framework extends `UIFont`, `UIImage` and `String` and generates an `enum Icon`. Cases are automatically created based on the name on Icomoon. (Example: `my-search` becomes `.MySearch`)
Copy to root of Project

```swift
import Icomoon
Project -> Target -> General -> Linked Frameworks and Libraries

let searchIcon = UILabel()
searchIcon.text = String.iconWithName(.MySearch)
searchIcon.font = UIFont.iconOfSize(30)
```
Add `Icomoon.framework`

![](http://imgur.com/mkLwS8V.jpg)

### Embed Framework

Project -> Target -> Build Phases

Add a New Section ("New Copy Files Phase"), titled "Embed Frameworks" (if not exist)

Add `Icomoon.framework`

![](http://imgur.com/xtBJosJ.jpg)

### Strip Architectures

![](http://i.imgur.com/gmXJXPg.jpg)
In order to submit to App Store, you'll need to automatically strip unsupported architectures (i386 simulator). Add this "Run Script" to you Build Phases, AFTER *Embed Frameworks*, or as the final entry.

In order to submit to App Store, you'll need to automatically strip unsupported Architectures. Add this Run Script to you Build Phases, AFTER *Embed Frameworks*:
![](http://i.imgur.com/gmXJXPg.jpg)

```
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
Expand Down

0 comments on commit 9e883c2

Please sign in to comment.