How to copy and paste files in Compile Sources from one target to another? How to copy and paste files in Compile Sources from one target to another? xcode xcode

How to copy and paste files in Compile Sources from one target to another?


Yes, you can follow these steps:

  1. Select all Compile Sources on the main target.
  2. Right click on the selection and choose Reveal in Project Navigator (CMD + Shift + j). The files will be selected in the left pane.
  3. Select another target.
  4. Drag and drop the selected files from Project Navigator to Compile Sources of another target.

Xcode 9.2 Update:

It looks like in Xcode 9.2 you can select only up to 150 items at once to use Drag and drop. If you want to copy more items you can do it in batches.


You can edit the PBXSourcesBuildPhase section in your ".pbxproj" file.You cand find the file by looking into your ".xcodeproj" file ( right click the project file + show package contents ). After you find the file look for "PBXSourcesBuildPhase". After you find the collection you can just copy/paste source files from one target to the others.


You can create a duplicate of the target by right-clicking the target and selecting Duplicate. Or press Command+D.

You can then modify the new target's build settings as needed.