TypedCatalog
is a CLI to support using Xcode Asset Catalog in Swift.
TypedCatalog development started as a fork of Misen.
It makes your assets code:
- compile time checked,
- strong typed,
- autocompletable by Xcode.
There are several methods to install Unstringify:
- Via CocoaPods
- Via Swift Package Manager
- Others:
- Download the ZIP for the latest release
- Via Mint (system-wide installation)
- Compile from source (only recommended if you need features from master or want to test a PR)
Usage: TypedCatalog \
-path path_to_asset_catalog \
-exportPath output_path \
-bundleName bundle_asset_catalog_belongs_to \
-bundleAssociatedClass some_class_inside_bundle \
-enumName generated_enum_name
Given a project where all the asset catalogs are contained in a development pod called Assets
.
-
Place your asset catalogs in the directory
Modules/Assets/Resources/
. -
Add the following to your
Modules/Assets/Assets.podspec
file:
s.resource_bundles = {
'CommonsUI' => ['Resources/*.xcassets']
}
s.script_phase = { :name => 'Generate Images Enums', :script => 'eval "${SRCROOT}/../Modules/Assets/Scripts/generate_images_enums.sh Assets ${SRCROOT}/../Modules/Assets/Resources ${SRCROOT}/../Modules/Assets/Sources"', :execution_position => :before_compile }
s.prepare_command = <<-CMD
Scripts/generate_images_enums.sh 'Resources' 'Classes/Images'
CMD
s.source_files = 'Sources/**/*'
-
Copy
generate_images_enums.sh
toModules/Assets/Scripts/
. -
Add
Assets
dependency to podspecs of all modules that will use the assets:
s.dependency 'Assets'
- Add the
Assets
module to the application'sPodfile
:
pod 'Assets', :path => './Modules/Assets'
TypedCatalog is released under the MIT license. See LICENSE
for details.