How do I get Xcode to replicate project group structure in the folder structure on disk? How do I get Xcode to replicate project group structure in the folder structure on disk? xcode xcode

How do I get Xcode to replicate project group structure in the folder structure on disk?


You can do this to some extent! There's just one extra step to do every time you create a new group (and this first time you'll have a lot of catching up to do!):

Xcode location setting

Whenever you create a group in Xcode, immediately select it and open the righthand sidebar. Notice the "Location:" setting just below its name. Click the folder icon next to "None" and set it to a new folder with the same name.

Now, whenever you add files to the group, they'll head to the corresponding folder on disk. Woo!

Unfortunately, this initial time, you'll have a lot of file-moving to do. (As you change the group paths, your files will all turn red, as Xcode will begin looking for them in the new folder. You'll have to manually move them from the Finder to fix it.) There is, however, a command-line tool to perform this initial migration for you: https://github.com/venmo/synx


A folder reference is what you want. When dragging or adding files to the project there is an option to "Create Folder References for any added folders". Choose that and you'll get the behavior you want.

alt text http://img.skitch.com/20081203-prtxsp7c36ern4afxxdixy93sq.png

You could try adding the entire enclosing folder of the project as a folder reference. That should get everything. Or add references for "Classes" "Resources" and "XML" individually.


Xcode9 solves this problem. By default, a new group is created with corresponding folder on disk.