Hello. This Saving Data course is very helpful, and most of what you’ve done in playgrounds I’ll be able to put to use in apps. But one thing I’m not clear about: how is the file system structured in iOS for use by apps?
Should I create a directory specific to my app within the Document Directory? It get the idea from what you say that there’s just one document directory, shared by all apps… but that seems unlikely, because it would seem to mean that apps could access each other’s data. So does each app have a separately sandboxed document directory?
Looking forward to putting this tutorial to use, but I won’t be able to until I know more about how documents are structured on iOS devices. Did I miss something in the tutorial? Or can you point me to somewhere where I can learn about that?
many thanks!
Anton
@jcatterwaul Can you please help with this when you get a chance? Thank you - much appreciated! :]
The “document directory” in question is indeed a separately sandboxed directory for each app. I’m sorry if we confused you; can you point to anything that we said which gave you the impression that, “there’s just one document directory, shared by all apps”?
Thanks, @jcatterwaul ! I don’t remember you saying anything about apps at all - just about playgrounds. I guess I just related what you said to the only document directory I know, which is ~user/Documents folder in MacOS. And that one is shared, not sandboxed.
best,
Anton
1 Like
That’s a great point. Our documentDirectoryURL
property returns exactly what you said, on macOS. We’ll be sure to clarify this in the future. Thanks!
Terrific. Thanks for the speedy reply, Jessy!
I think the decision to focus on playgrounds was a fine one—it kept out of the picture lots of stuff that would have been extraneous to what you were teaching.
Personally, I would benefit enormously for a section at the end moving the discussion to the realm of actual apps and touching on things such as when to read & write persistent data, in what methods, how often, whether writing should be done in the main thread or a background one… and perhaps even comparing these Codable methods to alternatives such as UserDefaults and Core Data.
BTW, I’m not saying any of this to school you or anything. Fact is, I’m just starting out and have never used any of these techniques! So I’m just hungry for your perspective on the the answers. I’m just poking around trying to figure out the best way to go for a particular app I’m building, and to learn the lay of the land for future apps. If these things are beyond the scope of what you were aiming at, then any pointers to good discussions about this stuff elsewhere would be great!
Thanks again!
1 Like