xcoderesourcesxcode16

How to build structured Resources folder in Bundle with XCode 16?


The question has been asked several times for previous (old) versions of XCode, but answers don't seem to apply to XCode 16.

How to embed, in the Resources folder of an App Bundle, resources with structured folders ?

Whatever I do (e.g. Group or Folder (blue or grey) file structured in the Navigator), I still get a flat list of all resources, which of course can't work if you have several resources with the same name (but in different folders).

Example, this will not build with XCode 16 because of the 2 resources "Marguerite.jpeg": enter image description here

I even tried with an additional run script

cp -r $SRCROOT/MyResources $BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH

but the Sandbox prevents that too.


Solution

  • The method is very obscure in XCode 16:

    1. Go to Copy Bundle Resources Phase
    2. Click the + Button
    3. Click Add Other
    4. Select the top directory of the structure you want to add
    5. In the "Choose options for adding these files" dialog, tick Create folder references
    6. Click Finish