2

A couple older questions (like this one) on this topic exist but I couldn't locate useful hints for Xcode 4 yet, so..

Is it possible to copy a group (with potentially hundreds of files from various folders on disk) from one project to another?

I.e. after painstakingly setting up all dependencies for a particular project can I just go ahead and copy that group (as in 'yellow folder') to a newly created project?

If it's possible in Xcode 4 it's at least not straight forward as

  • Copy and Paste is disabled for groups in Xcode4
  • Dragging a group doesn't work as the receiving project won't accept the drag

Any hints appreciated.

Community
  • 1
  • 1
Jay
  • 6,572
  • 3
  • 37
  • 65
  • Have you not tried using finder? Identify the resource folder in the project file for the source project and drag it into the resources area in the target project from the finder window? Have I misunderstood your question? – nerak99 Oct 06 '12 at 14:27
  • Sorry, you're not getting the question. I need to copy **groups**, not **folders**. – Jay Oct 06 '12 at 14:32
  • Yes, groups and folders are completely different, which is annoying. – sudo Mar 03 '15 at 08:10

1 Answers1

7

Ok, so here's the best workaround I've found:

  • Create a new Workspace
  • Add the projects where you want to copy groups from one to the other
  • Copy groups between projects!

That's it. You can either keep or get rid of the workspace afterwards as it doesn't directly affect the projects contained in it.

Bit clumsy but faster than other workarounds - at least until XCode 4.x adds support for direct copying between projects.

Jay
  • 6,572
  • 3
  • 37
  • 65
  • How do we do the second step exactly? I tried adding the project to the workspace according to Apple's documentation and didn't see its files, just the .xcodeproject file itself, so I couldn't copy the groups. – sudo Mar 03 '15 at 08:09
  • @9000 Hmm - should 'just work'. Did you close the projects before? AFAIR Xcode doesn't allow digging into projects when both the workspace containing a project and the project (directly) are opened at the same time – Jay Mar 04 '15 at 18:29
  • You're right, I had to close the projects first. It works now. I had never used a workspace before, so this was new to me. Thanks! – sudo Mar 04 '15 at 18:32
  • Ugh, it looks like some operations Xcode just decides to reference the groups and files instead of giving you the option to copy them :( – original_username Feb 23 '17 at 11:17