Core Data and CloudKit

I would really love to see a section on Core Data <-> CloudKit synchronization. This is something that I think many would find extremely useful.
I want to build an iOS and a MacOS app that synchronizes data across devices so I thought that CloudKit is the way to go. The data will be stored locally using Core Data, but I want to send changes up to CloudKit and make sure that all other devices are in sync.

I have done a lot of searching on this, but there is no simple, step-by-step tutorial for this.

7 Likes

I agree - I hope the next version of their book includes this. I just bought the current version, based on its description on Amazon which says it includes “syncing with iCloud” only to find that the most recent version of this book has removed the section. Looks like the new way to do this is via CloudKit, but there is no discussion of it in this book.

3 Likes

@cretech & @willclarke Thanks very much for your post, and my deepest apologies for the delayed reply.

The Core Data book’s focus is precisely that, Core Data. However, to get familiar with CloudKit, we do have an updated video course that you might find useful:

Beginning CloudKit

I hope this helps!

All the best. :slight_smile:

This is exactly what I need too.

1 Like

This is still exactly what I need. Core data alone is cool. CloudKit alone is cool. But what would be AMAZING is a book or course that is focused on using both together, keeping them in sync, resolving conflicts between the two data sources, etc.

3 Likes

take a look at the seam3 sync code on GitHub. it does what you are asking, and reading the source code is quite informative. I’ve just incorporated it, and it seems to work as advertised.

1 Like

Thanks - I’ll check it out!

I do wish to add here the link to the video from Apple on using Core Data with CloudKit from WWDC2019:

Using Core Data with CloudKit

1 Like

Based on that video, it looks like Apple has finally nailed it. Built in sync of CoreData by way of CloudKit. Looks very promising to me. I’m looking forward to Xcode 11.

1 Like

While I understand the original response to this question two years ago, it looks like NSPersistentCloudKitContainer could become a staple of Core Data development. If that’s the case, a related addition to the book would be immensely valuable, IMO.

1 Like

I agree. My impression from WWDC 2019-202 is that cloud syncing is considered by Apple to be a Core Data enhancement and not so much (if at all) a CloudKit enhancement, and so this subject would be a great and appropriate update to this book.

2 Likes