Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy image set from one asset catalog to another in Xcode

Tags:

xcode

Is there a trick to copy an asset like an image set from one asset catalog to another in Xcode? I have a large asset catalog in a project that I would like to break down into smaller ones.

like image 671
Berry Blue Avatar asked Feb 28 '17 00:02

Berry Blue


2 Answers

I just go to Finder, open the .xcassets source folder, and manually copy the .imageset files I'm interested in from it to the target .xcassets folder. In general, XCode sees the changes automatically, even if it's open during the operation (I tried it successfully in XCode 9.2).

After having copied, in order to make XCode completely aware of the resources, you can go through them, rename each one (for example by just adding a "" character at the end of the name), press ENTER and then rename them back to their original names (delete the added "" character). That way you will ensure that they are built into the project. This last operation is a bit tedious but could be pretty fast if you use only the keyboard.

Sometimes, this may require XCode to be restarted (and a project clean may be also good).

like image 140
nbloqs Avatar answered Nov 01 '22 03:11

nbloqs


A second editor can be used to drag/drop files from one asset catalog to another.

Select the source assets catalog, then select the "add editor" button. enter image description here

Select the destination assets catalog. enter image description here

Select the assets to be moved. enter image description here

Drag those files into the destination assets catalog. enter image description here

like image 35
Marcy Avatar answered Nov 01 '22 01:11

Marcy