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?
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.
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")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With