- Notifications
You must be signed in to change notification settings - Fork26
Three small tools to help you meet Xcode halfway.
License
puls/objc-codegenutils
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Xcode 5 has an awesome new feature called "asset catalogs", allowing you to specify all of your image variants and resizable cap insets in a single place.
Unfortunately, to get the full benefits, you have to set your deployment target to iOS 7; otherwise, Xcode will dutifully put all of the images into your app bundle but totally ignore all of your resizable insets with only a build warning.
But shucks! The important and awesome part is the editor, and it puts all of the data out in super-readable JSON. We should be able to do a poor man's version that reads in the data and spits out some code to give you most of the benefits.
Callobjc-assetgen
with the.xcassets
paths as arguments from the directory into which it should output the code.
For an asset catalog named "Foo" containing image sets "Bar" and "Baz", you'll getFooCatalog.h
andFooCatalog.m
, with class methods+ (UIImage *)imageForBar
and+ (UIImage *)imageForBaz
. Put them in your DerivedSources folder and you're good to go.
Usage:
objc-assetgen [-o <path>] [-f <path>] [-p <prefix>] [<paths>]
objc-assetgen -h
Options:
-o <path>
- Output files at
<path>
-f <path>
- Search for *.xcassets folders starting from
<path>
-p <prefix>
- Use
<prefix>
as the class prefix in the generated code -h
- Print this help and exit
<paths>
- Input files; this and/or -f are required.
About
Three small tools to help you meet Xcode halfway.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.