65

I have a directory structure (multiple levels deep) of resources, that I would like to include into the app bundle. Is this possible without creating a Copy Files phase for each directory in the hierarchy individually?

Jaka Jančar
  • 11,386
  • 9
  • 53
  • 74

2 Answers2

112

Drag the source folder to the project "Groups & Files" area, say under the Resources group. In the dialog select "Create Folder References for any added folders". This will create a blue folder and the folder will and it's inter hierarchy will appear in the apps resources. This will automatically create an entry in "Copy Bundle Resources" build phase This is commonly done for help files.

zaph
  • 111,848
  • 21
  • 189
  • 228
  • 21
    Note the important thing here: the folder must be a Folder Reference (blue folder). If it's a group (yellow folder), delete it and all its contents from your project tree, then re-add as a Folder Reference. Then make sure that's in the Copy Bundle Resources build phase. – cdespinosa Sep 16 '09 at 00:22
  • If you're using Xcode 9, this dialog won't appear unless you enable a hidden setting: `defaults write com.apple.dt.Xcode IDEDisableStructureEditingCoordinator -bool YES`. – saagarjha Jul 05 '17 at 19:25
0

As far as I know you can specify the top-level directory in the Copy Files phase, which should bring the entire directory's contents to the destination you specify.

fbrereto
  • 35,429
  • 19
  • 126
  • 178
  • I can't drag a *group* to copy files phase, only an individual file. Do you mean something else? – Jaka Jančar Sep 14 '09 at 20:08
  • If you right click on the Copy Files phase, I believe there is a place where you can specify the path of the item you want copied. Can you specify a directory in there? – fbrereto Sep 14 '09 at 20:34
  • You have Destination and Path there... I think Path is means as relative to the destination, not the source path. – Jaka Jančar Sep 14 '09 at 20:47