Where is the problem ?
- creating the directory in the app ?
- do you want to create it programmatically or in XCode ?
- transferring files there (in code or in XCode ?)
As I said to eskimo, my main concern is that the app be able to locate both types of file. At first I thought they'd have to be in the same directory. But upon reading the docs more carefully, it seems that's not the case.
What I'd like to do is have a directory called Data where both bundled and downloaded data files would reside.
That’s not really feasible. There’s two options:
Datadirectory in your bundle (A)
Datadirectory in your Documents directory (B)
If you do A, you can’t add downloaded files because your bundle is read-only. If you do B, the
Datadirectory starts out empty, so you’d have to copy the files from your bundle to the directory. This works, but it’s a bad idea for a bunch of reasons,
It makes updating your app tricky:
If you don’t do anything special, the
Datadirectory is left with the data from the old version of your app.
If you decide to update it, that’s a whole bunch of extra code.
You run the risk of bumping up against the iOS Data Storage Guidelines.
The approach I recommend is to maintain two directories, one in your app bundle for built-in data and another in the Documents directory (or Caches, or wherever). Then merge these directories when you present it to the user.
Even that isn’t trivial though. If the user deletes one of your built-in items, you need to leave a tombstone.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
My main concern is that the app be able to find both kinds of file. If I understand correctly how File Manager works (a big "if"), it should be able to locate them even if they're in different directories. So should I just leave the bundled ones alone, and put the downloaded ones into Resources?
I should add that I want the user to be able to delete the files if they wish. Some of them are huge, and they may want to save space on their device.