I'm looking at the sample code in the CoreDataCloudKitDemo. Doesn't the remove (duplicate tags) method here have a bug, since it is modifying a copy of the tags but not reassigning them to the post?
Code Block private func remove(duplicatedTags: [Tag], winner: Tag, performingContext: NSManagedObjectContext) { duplicatedTags.forEach { tag in defer { performingContext.delete(tag) } guard let posts = tag.posts else { return } for case let post as Post in posts { if let mutableTags: NSMutableSet = post.tags?.mutableCopy() as? NSMutableSet { if mutableTags.contains(tag) { mutableTags.remove(tag) mutableTags.add(winner) } } } } }