I wanted to remove a single folder from the image collection, however, I somehow managed to throw the entire xcassets file into the trash.
The normal 'Put back' method is not available, and simply dragging the deleted folder to XCode yields an error:
"Images.xcassets" couldn't be copied to "ProjectPear" because an item with the same name already exists.
To save the file, either provide a different name, or move aside or delete the existing file, and try again.
I'm not sure where this collection is located within my XCode project, as the navigator doesn't appear to show anything, and the command-line isn't dropping any hints either. I'm afraid to mess around with the project.pbxproj
file, as it might jumble up a lot more than just my image collection.
Edit: Dragging the files back to Finder from Trash was successful, however, the XCode navigator no longer recognises - or in this case, still doesn't recognise - the .xcassets file. I'm not sure whether to add something in the .pbxproj file.
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.
Had the same problem today with Xcode Beta, I also couldn't create a new assets catalog for some reason. This was on a Watchkit Extension Project Here's what I did to solve it:
That fixed it and everything went back to normal.
I had same problem and I have followed the steps above from Jason, but finally i got Image.xassets in red color, so the in order to find my images I had to click in Image.xassets and then on the top right corner put the absolute path to my image.xassets folder and it fixed my problem. Hope it helps!