Post

Replies

Boosts

Views

Activity

Reply to SwiftData Configurations for Private and Public CloudKit
ModelConfiguration so far lacks an NSPersistentCloudKitContainerOptions.databaseScope equivalent. Even if you were to divide data into two stores, it seems that the automatic CloudKit sync would still default to .private for both. There is some discussion of coexistence between Core Data and SwiftData, with both accessing the same store. It might be possible to setup the Core Data side to perform the public database sync and the SwiftData side to operate as a reader of that store.
Jun ’23
Reply to NSSecureUnarchiveFromData is now necessary for transformable attributes but does not work with Core Data CloudKit?
I was able to remove the warnings by registering a new value transformer. I'm persisting a CLLocation, which conforms to NSSecureCoding. import Foundation import CoreLocation @objc(CLLocationValueTransformer) final class CLLocationValueTransformer: NSSecureUnarchiveFromDataTransformer {     static let name = NSValueTransformerName(rawValue: String(describing: CLLocationValueTransformer.self))     override static var allowedTopLevelClasses: [AnyClass] {         return [CLLocation.self]     }     public static func register() {         let transformer = CLLocationValueTransformer()         ValueTransformer.setValueTransformer(transformer, forName: name)     } } Adding CLLocationValueTransformer as the transformer name works without warnings. The value is synced properly via NSPersistentCloudKitContainer, verified on multiple devices.
Aug ’20