Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Groups & Files: How can I copy files from project A into project B without getting crazy?

Tags:

xcode

iphone

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?

like image 982
Thanks Avatar asked May 26 '09 11:05

Thanks


People also ask

What are groups in Xcode?

A group is a collection of resources in your project. By default, Xcode maps each group to a folder in your project directory, but you can also create groups without an underlying file-system folder.

How do I create a group in Xcode?

When you right-click (or control-click) in the project navigator, the context menu will include a “New Group” menu item and either a “New Group with Folder” menu item or a “New Group without Folder” menu item. If Xcode offers “New Group” and “New Group with Folder”, then “New Group” creates a group without a folder.

What is a group in Swift?

A type that collects multiple instances of a content type — like views, scenes, or commands — into a single unit.


2 Answers

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.
like image 100
cdespinosa Avatar answered Nov 15 '22 13:11

cdespinosa


Copy icon files in a filtered-Finder window to an "icon-only" folder. Then import them into your new Xcode project. Repeat for any other categories.

like image 39
Alex Reynolds Avatar answered Nov 15 '22 14:11

Alex Reynolds