I am developing an iOS notes app where a user can add image, text, audio and drawing notes. I want to implement iCloud synchronization between multiple devices. Out of the 3 options (key value, document storage, CloudKit) which one should I choose? I would like to implement the sharing of notes (collaboration) among users as well. I am using core data as my DB currently.
2
There are 2 answers
1
On
IMHO, CloudKit is the only opinion :)
I have a note app named marknote
. And at the beginning I used iCloud document storage. It worked sometime, but not stable. The worst thing is, when and whether your documents can be synced is out of your control, instead it relies on Apple's daemon service. It becomes even worse when your documents are a little big, for instance several mega bytes.
So after fighting for some time, I changed to CloudKit. As @maxim-volgin has already pointed out, the implementation of CloudKit sync is tough, but it is reliable. And all headache just gone after switching to CloudKit.
Key-value storage is out of question due do being too limited for your goal, document storage is only recommended when you need to handle and store the document as a whole. Since you are already using
CoreData
for local storage, it only makes sense to use regularCloudKit
with it for cloud storage and sharing.Synchronisation of
CoreData
andCloudKit
can be tough. I am personally using a combo ofRxCoreData
andRxCloudKit
libraries which provide some relief in synchronisation and some syntax sugar too.A word in advance about uniqueness constraints: for
CoreData
, you define them based on key(s) or hash of all values, forCloudKit
it is only possible (and also required) for theCKRecord
key, to the best of my knowledge. So it is best to take care of it from the very start.