Xcode - How could you copy paste classes / files from one project into another?

I know, I'm late to the party but posting the answer here. so it could help someone.

Basically copying files from the finder won't show in Xcode. You have to add files explicitly from Xcode. Follow below steps

  1. Copy files to your project folder first
  2. And then in Xcode project navigator, right-click on the folder and click on Add Files to "project-name"

Note: Don't directly add files from another project folder, Xcode will copy the reference of the file instead of copying it.

enter image description here

voila! now the file is added to the project, under the selected folder


The project navagator in XCode with the folders and files has nothing to do with what files are in your project folder in Finder. You will see that the navigator contains 'folders' that do not even exist in the directory on the Mac.

Once you've dropped the files into the project directory, you need to add them to the project. Right click the folder in the navigator you would like the files to go into, and select "add files to 'your project name'"

Alternatively you can drag files from one Xcode project to another in the navigator.

Hope this helps.

Tags:

Xcode