Post

Replies

Boosts

Views

Created

CloudKit - moving record objects between zones
My app has three main SwiftData models: Collection, SavedItem, and Extract. A Collection can contain subcollections (folders within folders) and SavedItems (files). Each SavedItem can have child Extracts. I'm preparing for the ability for users to be able to share Collections with each other. Currently, my architecture treats each Collection as the root of its own CloudKit zone (a root parent Collection and all of its items and subcollections live in 1 zone). This makes sharing and isolation straightforward, but it also means that moving a SavedItem or subcollection between Collections involves moving it across zones. I’m trying to figure out the best pattern for handling these cross-zone moves while keeping data integrity, relationships, and sharing intact. My understanding is that in CloudKit, and moving a record from Zone A to Zone B would require deleting it from Zone A and recreating it in Zone B - while somehow maintaining the link back to my local SwiftData store. Has anyone run into this or know how best I should handle it?
2
0
342
Nov ’25