Using Xcode Asset Catalogs with Multiple Targets
A few months ago, I released an App called NYC Bikes that quickly became the most popular non-official Citi Bike app. It resonates with busy New Yorkers because it takes far less time to get the same amount of information than the official app, and it actually works. Expanding to other cities where Bike Shares exist was a no brainer. Just this last week I released the second of these bike share apps: Chicago Bikes. The apps share the same UI, 99% of the same code base, with only API endpoints, colors, strings and images swapped out. When building the base framework that would allow me to create new apps for new cities, I found it particularly easy to use Xcode's new image asset catalog feature. This allowed me to place all shared images in one asset catalog, and the local images in another that would only apply to that particular city, separated by targets. Then building the apps would pull in the right assets for that target from the xcassets file that pertained to it. Unfortunately, Xcode had other plans.
Matt Coneybeare