Skip to content

Instantly share code, notes, and snippets.

@a13xb
Created January 11, 2016 12:21
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save a13xb/cf07c19c75ec5b4709a9 to your computer and use it in GitHub Desktop.
Save a13xb/cf07c19c75ec5b4709a9 to your computer and use it in GitHub Desktop.
Quick workaround for per-target asset catalog compilation using a Podfile post_install hook
# ...
# Workaround for https://github.com/CocoaPods/CocoaPods/issues/1546
post_install do |installer|
installer.aggregate_targets.each do |at|
files = at.user_targets.map{|t|
t.resources_build_phase.files_references.select{|f|
f.last_known_file_type == 'folder.assetcatalog'
}.map{|f|
Pathname.new(f.real_path).relative_path_from(f.project.path.dirname)
}
}.flatten
script = at.copy_resources_script_path
files = files.join('" "')
`sed -i '' 's@OTHER_XCASSETS=.*@XCASSET_FILES+=(\"#{files}\")@' '#{script}'`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment