XCode: How To Actually Drag And Copy Files Into Your Project Directory

So there is something that’s been driving me super crazy ever since I started using XCode. Whenever I drag in an outside file into my project (like an image I just downloaded from the internet), the file gets copied by Reference, and not actually saved in my project directory.

I noticed this when I deleted some images from my desktop (thinking they were now copied over to my project directory), and all my images in the project disappeared. The images also don’t go up to Github, so when someone else downloaded my project to check it out, they were missing the images. If I released this app, it would be missing the images as well! So I really don’t know why it’s even an option to NOT copy over the actual file into your file directory.

So recently, I’ve been making sure to save the files in my project directory (via the Finder), and then drag the images over to my XCode project from the project folder in the Finder. Again, super painful, but at least the references to the images in XCode pointing to the images in my project folder.

Yesterday, however, my friend mentioned that all I have to do is check the “Copy items into destination group’s folder (if needed)” option to actually copy the files into my project directory. This is a much easier solution! Too bad the vague wording doesn’t make it clear what that option actually means!


Enjoy the article? Join over 17,500+ Swift developers and enthusiasts who get my weekly updates.