Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Three small tools to help you meet Xcode halfway.

License

NotificationsYou must be signed in to change notification settings

puls/objc-codegenutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

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.

Usage

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.

Command-line options

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

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp