Sync an iOS app that uses core data to cloud

I have written an app, using Swift 2 and Core Data for persistence, that is close to finished. I am thinking about adding a feature to also persist in the cloud. I have read tutorials on Realm and CloudKit, but haven't seen great examples on using them on top of (or along with) Core Data.

#1: I simply want to allow users to enter their data once and have it appear on all their devices.

#2: I also want them to be able sync some of their data with a user of their choice.

Can I keep all my Core Data logic and simply add some server calls during CRUD operations using CloudKit (or some other framework)?

Any help appreciated!

Replies

Yes, you can make it work this way. But keep in mind - syncing a local cache (like your coredata storage) with CloudKit is very hard. Think of conflict management (several users change records at the same time), change tracking in your local cache (it is not always possible to talk to CloudKit because a user might have no internet connection) and so on...