Skip to content

Commit

Permalink
Describe what Misen is and how to use it in README
Browse files Browse the repository at this point in the history
  • Loading branch information
tasaka-kazunobu committed Jun 29, 2015
1 parent 55d8589 commit cebc1ba
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,57 @@
# Misen
Misen is a script to support using Xcode Asset Catalog in Swift.

# Features
Misen scans sub-directories in the specified Asset Catalog and creates a UIImage extension file which has the following features.
- Application-specific enums which is constructed from Asset Catalog names.
- UIImage non-failable initializer whose argument is an enum value above.

#### e.g.
Misen creates the UIImage extension file from the asset catalog with 3 image sets below.

<img src="images/asset-catalog.png">

```
extension UIImage {
convenience init!(assetName: AssetName) {
self.init(named: assetName.rawValue)
}
enum AssetName: String {
case Camera = "Camera"
case Home = "Home"
case Mail = "Mail"
}
}
```

- In your code, you can instantiate images in Asset Catalog as follows.

```
let camera = UIImage(assetName: .Camera)
let home = UIImage(assetName: .Home)
let mail = UIImage(assetName: .Mail)
```


# Usage
- Change file permissions first.

```
chmod +x misen.swift
```
- Run the script.
- ```-path``` is a path of the asset catalog.
- ```-exportPath``` is an output UIImage extension file path.

```
./misen.swift -path PATH -exportPath OUTPUT_FILE_PATH
```

# Requirements
- Xcode 6.3
- Swift 1.2

# License
Misen is released under the MIT license. See LICENSE for details.
Binary file added images/asset-catalog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cebc1ba

Please sign in to comment.