What Is It?

Asset Generator is a Mac app which takes design assets and adds them to your Xcode project's asset catalog. Its goal is to bridge the gap between designers and developers: the former can pull project repositories and update assets (in a hopefully intuitive way) without bothering the latter.

How to Use?

Simply drag a folder with images or multiple image files onto the left well, drag an Xcodeproject file onto the right well and hit Build.

Asset Generator Screenshot

Download

Grab the latest build here.

Features

  • Automatically detects asset types based on keywords and image metadata.
  • Supports iOS and Mac assets (including icons, launch images, Spotlight and settings assets, and more).
  • Merges new assets with existing catalog data so you can incrementally build assets as you go in a safe manner.
  • Preserves content created through Xcode such as slicing information and size classes.
  • Dynamically tracks location of both source and destinations when moved.

Keywords

Keywords are tags added to the image filename that help the app determine the proper information of the image. The good news is, if you follow Apple's naming convention you're already done! If not, it's very simple. Asset Generator keywords take the following form: <ImageName><PixelDensity><Device>.<Extension>

where:

  • <PixelDensity> is either @2x, @3x or blank for @1x.
  • <Device> specifies the target device which can be either ~iphone, ~ipad, ~mac, or blank for universal.
  • <Extension> are the support image extensions which are png, jpg and jpeg.

App Icons

  • For iOS icons, the <ImageName> must start with either "AppIcon" or "Icon" and Asset Generator takes care of the rest.
  • Mac OS icons must start with "icon_" and must follow Apple's naming convention found here.
  • More information about iOS icons can be found here and here.

Launch Images

  • For launch images, the <ImageName> must start with either "Default" or "LaunchImage" and Asset Generator takes care of the rest.
  • More information about launch images can be found here and here.

General Images

For all other assets, you need to provide all the keywords mentioned above and the app will parse the data as such. For example Button@3x~iphone.png is a @3x iPhone button image and Spinner@2x.png is a @2x universal spinner image.

Notes

  • Asset Generator does not scale or compress your assets. You need to prepare all different dimensions yourself.
  • You need to have an asset catalog in your project to use Asset Generator.
  • If you have multiple catalogs in your project, Asset Generator will use the first one (alphabetically).

How to Build

  1. Clone the repo into your machine.

  2. To build the project dependencies, install Carthage with Homebrew as follows:

    $ brew update
    $ brew install carthage
  3. Run carthage update to setup the dependencies.

About

Asset Generator is a collaboration between Bader Alabdulrazzaq, iOS and Mac OS engineer who graciously greeted Sourcebits for an internship in late 2014, and Sourcebits' Chief Innovation Officer Piotr Gajos. App icon was designed by Sourcebits' senior interaction designer, Rick Patrick.

The app was designed in Sketch and coded in Swift.

We would like to thank all Sourcebits developers and designers who helped us with feature ideas and relentless bug reports.

License

Asset Generator is released under the MIT license. See LICENSE for details.