Latest 0.2.0
Homepage https://github.com/bananita/MBImageConstants
License MIT
Platforms ios 6.1
Authors

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'

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.

Latest podspec

{
    "name": "MBImageConstants",
    "version": "0.2.0",
    "platforms": {
        "ios": "6.1"
    },
    "summary": "Simple XCode 5 script that generates constants corresponding to image.",
    "homepage": "https://github.com/bananita/MBImageConstants",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Michau0142 Banasiak": "[email protected]"
    },
    "description": "MBImageConstants is a simple XCode 5 precompile script that generates precompiler defines corresponding to image sets found in a project's assets.",
    "requires_arc": false,
    "source": {
        "git": "https://github.com/bananita/MBImageConstants.git",
        "tag": "0.2.0"
    },
    "source_files": "*.{h}",
    "resources": "*.rb"
}

Pin It on Pinterest

Share This