MBImageConstants 0.2.0

MBImageConstants 0.2.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.


Downloads

Total5
Week0
Month0

Installs

Apps2
powered by Segment

GitHub

Stars1
Watchers1
Forks1
Issues2
Contributors2
Pull Requests0

Code

Files1
LOCLines of Code 0


  • By
  • Michał Banasiak

MBImageConstants is a simple XCode 5 precompile script that generates precompiler defines corresponding to image sets found in a project's assets. It allows autocompletion for image names and protects against typos.

Requirements

Script works with XCode 5 and project using Images.xcassets to store images. It is a Ruby script so it needs Ruby installed on the build machine.

Installation

Installation is divided at three steps. First, add proper line to your project's Podfile:

pod 'MBImageConstants', :git => 'https://github.com/bananita/MBImageConstants.git', :tag => '0.2.0'

Next, you have to add a new phase to your Project's Build Phases between Check Pods Manifest.lock and Compile Sources. It is simple invocation of ruby with MBImageConstants script:

ruby ${PODS_ROOT}/MBImageConstants/imageconsts.rb ${SRCROOT}

Third, the last step is inserting import to your application prefix file (.pch):

#ifdef __OBJC__
...
#import <MBImageConstants/MBImageConstants.h>
...
#endif

That's all! You can build your project now.

Using

Constants for all image sets will be created with 'image_' prefix. For example:

UIImage* background = [UIImage imageNamed:image_Background];

Contributing

If you'd like to contribute code, fork the project at github, make your changes, then send a pull request.

License

This code is free to use under the terms of the MIT license.