Maury Markowitz
Maury Markowitz

Reputation: 9293

Copying resources into subfolders

I'm porting some code from the Win world that expects resources to be in certain places, ./graphics, ./sounds, etc.

In the past I've always relied on the Copy Bundle Resources to do this sort of thing, but it flattens it out into Resources, so the subdirectories disappear.

I suspect the solution has something to do with adding a new Copy Files step, but it doesn't seem that I can add an entire folder this way, nor subfolders.

Is there something I'm missing here? Or will I have to make a separate Copy Files for each subdirectory?

Upvotes: 0

Views: 70

Answers (1)

Swift Dev Journal
Swift Dev Journal

Reputation: 20088

When you add the folder of files to your project, there are two options to add the folder: create groups and create folder references. For graphics and sounds files, you should create folder references. If you create a folder reference, the folder will be added to the Copy Bundle Resources build phase and will be copied to the Resources folder of the app bundle when you build the project.

How do you know if you created a folder reference or a group for your folder? Look at the color of the folder in the project navigator. If it's blue, you created a folder reference. If it's yellow, you created a group. If your file folder is yellow, remove it from the project, making sure you just remove the reference. Add the folder to your project, making sure to create a folder reference.

Upvotes: 1

Related Questions