Reputation: 21512
I have a folder structure 10 deep or so. I need to copy that full structure into my app resource folder. Is there an easier way than manually recreating it with 100s of copy phases for each of the folders?
Upvotes: 11
Views: 9033
Reputation: 124
It is still the same in Xcode 12: Check the Create folder references box when adding the root folder of your folder structure to the project.
To access the resources in code, specify the subdirectory path in your call to Bundle.url()
:
Bundle.main.url(forResource: "blabla",
withExtension: "txt",
subdirectory: "A/B/C/D")
Upvotes: 7
Reputation: 33329
When you add a directory to Xcode, there is a tickbox (on by default) to convert folders into groups.
Turn that off, and it will do what you want.
Upvotes: 22