Xcode build phase for generating scaled assets
Xcode users know that scaling image and AppIcon assets is inefficient. Even by using tools that generate icons, precious time is spent dragging and dropping. Asset Generator is a completely automated tool that runs during your project's Build Phase. For every image and icon in .xcassets folders, Asset Generator will find the largest asset and scale it to fill any missing sizes.
These instructions will show you how to implement Asset Generator as an Xcode build phase in your project.
Adding to Xcode
Download files from the scripts folder and place them in your desired Xcode target.
In project settings:
Target > Build Phases > + > New Run Script Phase
In the Run Script Phase, enter:
Using in Xcode
Build your project and assets will be generated.
For assets, you may provide any size, but you will recieve a build warning unless the largest required scale is provided.
By default, all assets will be generated from the largest asset during build. To generate only missing assets, change the contents of
generateAssets.sh by removing the
ruby $PROJECT_DIR/$PROJECT_NAME/AssetSpec.rb -a ->
The provided scripts are starting points for your own implementation. If you encounter bugs in the provided scripts, please report an issue.
If you have enhancements or feature requests, report an issue or create a pull request.