I'm trying to figure out how to do package FileWrapper
s w/ UIDocument
s (or SwiftUI ReferenceFileDocument
s) properly. I.e. so that they also sync reliably as iCloud documents.
In the load
/init
I get the NSFileWrapper
and Apple's examples just store that (and also return or create that in the respective "save" operation).
If I subsequently access files in the wrapper (e.g. either reading or writing to them, say a SQLite DB), do I have to protect that using NSFileCoordinator
s myself? Probably?
Do I have to use NSFilePresenter
manually to detect changes to the wrapper? In particular w/ ReferenceFileDocument
s, which do not have a "load" method, just an init
(are they recreated from scratch when a wrapper was modified by a different device?).
Also, the methods just return a FileWrapper
, which is a class, how is that thread safe (e.g. for background snapshots) if I return the same one I got in the load?
Could someone clarify the whole snapshotting? E.g. how would I properly snapshot a big package filewrapper containing lots of images or other files?