CloudKit backed SwiftData @Relationship

Hi, does anyone know how to get @Relationship in SwiftData to cascade to the CloudKit container? I've managed to get SwiftData classes to show up in CloudKit but they are not related in line with the @Relationship as per the example project:

@Relationship(.cascade)
var bucketListItem: [BucketListItem] = []`

They are simply separate records. As result the cascade of deletes doesn't work.

Any ideas?

  • it should work, and if not, file a bug report

Add a Comment

Replies

Unless the situation has changed recently, it is my understanding that cascade does not work in iCloud+CoreData. Since SwiftData seems to be a layer on top of CoreData, one would suspect that cascade shouldn't work for it either.

This is, I agree, a real pain. In CoreData, there were enough hook functions in NSManagedObject that one could manually handle the cascade operation, but I've been unable to find any suitable hooks that could be used.