Accidentally removed xcassets file from Xcode project

Usually the file's reference is removed from Xcode, the original folder still exists in the project directory.

Right-click on your project folder, click "Add files to "your project"", find Assets in your project and click Add and you're done

enter image description here


I just did this myself and figured out how to quickly remedy the issue.

  1. Go to the project folder in the Finder. You should find that the folder Images.xcassets is still there.

  2. Move it to a separate location like to the Desktop or something. It still has all of the images and json files.

  3. Jump back to Xcode and create a new asset catalog for images.

    File > New > File... > Resource > Asset Catalog

    Name it Images.

  4. Quit Xcode and return to the Finder.

  5. Copy the folders from within your old Images.xcassets to the new Images.xcassets directory in your project.

  6. Launch Xcode and you're back in business!


If you didn't delete it completely, you can just drag it back in from Finder. (Right click your project and select 'Reveal in Finder' to check)

If it's gone completely you simply go Cmd+N -> Resource and select Asset Catalog. You then re-add your imagages via drag and drop or right-click and 'Add Files to ...' and should be good to go.

Hope that helps.

Tags:

Ios

Xcode

Xcasset