Post

Replies

Boosts

Views

Activity

How do I properly access package FileWrapper's in UIDocument's
I'm trying to figure out how to do package FileWrappers w/ UIDocuments (or SwiftUI ReferenceFileDocuments) 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 NSFileCoordinators myself? Probably? Do I have to use NSFilePresenter manually to detect changes to the wrapper? In particular w/ ReferenceFileDocuments, 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?
1
0
984
Aug ’21