Getting familiar with xcassets asset catalogs

I'm in the midst of moving all of my images into asset catalogs, adding size classes, and applying tags.

I have two kudos's to share for any Apple engineers who might be reading: it's been really useful to work with multiple selected assets, thank you for allowing multiple selection; and, it's been really useful to drag a set of images into an asset catalog and have them associated with each other based on file name (e.g., .png, @2x.png, @2x~iPad.png).


I started with single monolithic asset catalog, but then I realized that I will need multiple asset catalogs in order to separate out some images between Xcode targets (different apps), but not before I already started adding and configuring a ton of assets that now need to be separated out. So, I have two workflow questions:


  1. Is it possible to break out a set of assets, that are already in an asset catalog folder and configured with size classes and tags, into their own asset catalog file? If so, how? I tried dragging them out but that doesn't work.
  2. Is it possible to "name" image files appropriately for size classes, so that when I drag a set of images, they are associated with each other by size class? If so, what is the naming convention? I know this works for ~iPad, but I'm transitioning away from specifying iPad to specifying size regular.


Thanks in advance for any tips on these.

Accepted Reply

For #1, you can duplicate the asset catalog in your project folder then delete assets you don't want in the duplicate. This is probably the easiest way. Just keep in mind that only 1 asset catalog per bundle is supported.


For #2 there aren't names for size classes as "loose" files.

  • "Just keep in mind that only 1 asset catalog per bundle is supported."

    @Rincewind can you advise if this is still the case and provide a source?

Add a Comment

Replies

For #1, you can duplicate the asset catalog in your project folder then delete assets you don't want in the duplicate. This is probably the easiest way. Just keep in mind that only 1 asset catalog per bundle is supported.


For #2 there aren't names for size classes as "loose" files.

  • "Just keep in mind that only 1 asset catalog per bundle is supported."

    @Rincewind can you advise if this is still the case and provide a source?

Add a Comment

OK, so I see that duplicating the xcassets and then pruning inside of Xcode appears to do the job. I'll follow this through to its logical end, and let you know if I was successful.

That is strange (to me at least), but you should be able to prune in the Finder (at least after you've closed the project or quit Xcode).

Sorry I edited my previous response (operator error) and you were very quick to respond. Your initial suggestion worked, I needed time to validate the results in a unit test, and it works: it can find all of the assets I expected to find from multiple xcassets sources compiled into a single framework bundle.