Any plan to include a chapter for NSPersistentCloudKitContainer?

Use Core Data with CloudKit to give users seamless access to the data in your app across all their devices.

This was announced at the most recent WWDC so I was a little disappointed to see that it isn’t mentioned in the recent (many thanks!) update of the Core Data book. Does RW intend to cover this in the future/elsewhere?


I’d love to see some tutorials on this too, particularly the best way to handle certain scenarios:

  • how to best sync an existing database when app is first updated
  • how to show the user than data syncing is complete (or not) - can’t see a way to do this at the moment. Errors show on the console (ie. .limitExceeded) but there is no way to relay this to the user via the UI.
  • how to stop local data vanishing when the user turns off iCloud for your app in Settings - this is easy enough to do within your app (ie. presenting either NSPersistentContainer or NSPersistentCloudKitContainer depending on the user’s preference - stored in UserDefaults).

I’ve spent the last 3 months updating my app for iOS 13, but I’ve left this NSPersistentCloudKitContainer functionality until the end as there are still some issues (above) I need to address so my users don’t think their data is corrupt as it syncs in fits & starts!


@magnas We will definitely include a chapter about this in a future version and release of the book.


@nitramluap Thank you for your suggestions - much appreciated! I will definitely forward them to the tutorial team.

1 Like

Yeah, I would like that too. I am trying to implement it taking help with this book and Brian’s course but it does not seem very helpful as in “NSPersistentCloudKitContainer” We aren’t writing any of cloudKit code. which confused me where to write code to make it work.

@magnas @nitramluap @alokc83 Please check out our updated Core Data book when you get a chance:

I hope it helps!

Many thanks for this! I’m diving in right now.