Search code examples
core-datacloudkit

Using both public and private cloud kit database synched with CoreData


I have watched Nick Gillette's WWDC2020 talk on using the public Cloud Kit database synched with CoreData but I am confused on how to tell the system I wish two entities to be in the public database and the rest to be in the private database. The use case is some help text which is available to all users as well as images that are available to all users, everything else requires a share invite. The app has been working fine with just the private database and shares, now I am trying to add the public data. I have already made the mods needed to configure the public store so I think all I need is the ability to tell Cloud Kit which entities are public.

Can anyone point me in the right direction?


Solution

  • I think you'll need a feature of NSManagedObjectModel called Configurations to create a config that contains only the public entities. And also use CloudKitContainerOptions on an extra store description that uses the config and the public database.

    These are covered in Nick's talk a year earlier: Using Core Data with Cloudkit WWDC 2019