Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between Xcode's move to trash and remove reference?

Tags:

When I want to delete file in Xcode. Between "move to trash" and "remove reference" which one should I choose?

I always choose move to trash before cause I thought it will definitely delete the real file. But not sure if that's right. So what is the difference between them?

like image 322
itenyh Avatar asked May 24 '12 15:05

itenyh


People also ask

What is remove reference in Xcode?

To remove reference, in XCode, right click on the file then Delete . A pop-up will show asking if you want to move to trash or remove reference . However, that popup won't show if you made any changes before doing Delete on XCode.

How do I delete files in Xcode?

Right-click the file --> Delete --> Move To Trash It will remove all the files and linked reference from your project.


1 Answers

Xcode stores references to the files that make up your project in the project file, namely, the projectName.xcodeproj file. Theoretically your source and resource files that make up your project could be all over your harddisk; of course that's not a good practice.
So, when you add an existing file to your project, Xcode asks whether you want to copy it into your project's folder, which is usually what you should do. So, when you go to delete a file Xcode will ask you whether you only want to remove the reference from your project (and keep the file wherever it lives on your drive) or if you want to remove the file as well.

Basically if you check "Copy to project" when adding the file, you should chose "Move to Trash" when deleting, otherwise pick "Remove Reference". This latter option will leave the file in place and just remove the reference to it.

like image 50
DrummerB Avatar answered Sep 29 '22 05:09

DrummerB