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?
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.
Right-click the file --> Delete --> Move To Trash It will remove all the files and linked reference from your project.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With