Adding iCloud docs - design suggestions wanted

I'm looking at adding iCloud support for an existing iOS app. In the future, there will be a macOS version as well. It's purely a reader/viewer, but keeps track of certain user settings and statuses per document. It does not use UIDocument.


Currently getting files into the app require loading them on a Mac via iTunes, or importing each file one at a time on the iOS device. So my primary reason for moving to iCloud is to make this process much easier. The iOS app scans its doc directory for files and displays a list of them to the user, much like the Books or Pages apps. The macOS version will work more like TextEdit, where the user will choose to open a doc, either from the iCloud Drive or from the local file system (in which case it will not keep the status to the cloud). How would a user move downloaded files into my app? Like, can the iCloud Drive have a top level MyApp doc folder like it does for TextEdit, Preview, Pages, Shortcuts, etc?


The other reason why I want iCloud support is to sync the status of each doc; language chosen (some files might have translations), font size chosen, current page, etc.


I've already done some testing using CKRecord, CKContainer, etc to store a simple record in the cloud and get it back. This would work if I only wanted to keep the statuses synced across devices. But I also need these status records to go away if a document has been deleted.


So what options might be good for this scenario? I don't mind doing all the NSFileCoordinator/NSFilePresenter work, since i'm not using UI/NSDocument.

Replies

Really? Nobody wants to help?

Use CloudKit. It's a database. If your problem is "I also need these status records to go away if a document has been deleted" then delete them! There are sophisticated methods of deleting child/parent records.

I was kinda hoping for more indepth discussions, based on the number of directions one can attack "support the cloud" and the number of questions I had.

Forgive me for answering your question without the specificity you require. Good luck with your project.

Jeez, I'm just looking for longer suggestions, not a simple "use CloudKit". Don't be so easily offended.