Iphone – Xcode Groups & Files: How to copy files from project A into project B without getting crazy

iphonexcode

For some reason, the representation in Xcode "Groups & Files" does not match the file hierarchy in the folder where all my real project files are. And for some reason, I can't copy a entire group or even single file and put that into another project. So I have a nice hierarchy of images within "Groups & Files", but all thos ordered images are unordered like a big mess in just one giant folder full of stuff on my file system. Really horrible 😉

So now I wanted to put all my icons into another project, but I cant just copy the Group "img > gui > icons". I have to pick every single icon image from my file system, where icons are mixed up with a few hundred other images and files.

Is there some hidden option I can activate so that Xcode will manage to reproduce the hierarchy of "Groups & Files" inside my project folder on the file system? Or how else could I copy those files?

Best Answer

It's not really possible to transplant a Groups hierarchy intact from one project to another. Some suggested approaches:

  • If the files you want to bring across are the vast majority of the project, just clone the project and delete everything that's not the files you want to copy.
  • If it's a lot of files in a small number of groups, then set up the groups in the new project, and drag-copy the files from the old project groups into the new project groups
  • Write an AppleScript to move the hierarchy across with a recursive-descent algorithm
  • ◆◆ Open both project.pbxproj files as text files, and carefully copy the File References and Group References from one to another.