I'm using CloudKit+CoreData to sync ... looking for faster alternative channel when multiple computers are editing at same time

I am using CloudKit+CoreData to store and sync and share my apps data. In my somewhat limited testing this is working quite well, but sync performance is unpredictable. Often it is very fast, sometimes it just stops until I put Mac app in background or restart. I guess from this thread this behavior is by design:

https://developer.apple.com/forums/thread/756315

I'm accepting that! :)

My plan is that I will use CloudKit+CoreData for source of truth syncing, but now I'm looking for an alternative channel that I can use to sync when multiple devices are working on this data at the same time. I think the basic design could be:

  1. When a device starts editing a CKRecord
  2. Post device IP and record ID to well known location/discovery service
  3. Watch that location to see other devices that are editing that record
  4. Make direct connection to those devices and sync through that connection (still also saving/merging with iCloud).

I think I know how to solve the data merge problems that will show up in this scenario, but I don't know what technologies I should use to create the sync channel. I'm looking for ideas. I don't want to run my own server.

  • SharePlay session seems almost perfect, but I'm not sure if it's really intended for this purpose. In particular I would want the session to start automatically (using participants from CKShare) without users having to manually join. Also I would like it to work with a single account (when I am viewing same data on my Mac and iOS device).

  • My other thought is that I would store active users+ip's in the synced CloudKit+CoreData store and then use Network.framework to connect and sync those active users. I think this could work, but is quite low level and might be a lot of work.

Are there other options that I'm missing or things I should think about?

Thanks, Jesse

I'm using CloudKit+CoreData to sync ... looking for faster alternative channel when multiple computers are editing at same time
 
 
Q