No word yet on this?
Post
Replies
Boosts
Views
Activity
I filed a feedback on this.
My app uses a CloudKit public database and a private database. The image data in the public database is saved as a CKAsset and the data from the downloaded asset is saved in SwiftData. That data is not JSON data. Again, this works well until beta 5.
Has anybody gotten any word on this? It's still and unknown to me.
Don't forget to use .cascade if you want to delete the related models when you delete the parent model.
The link to gravity and heading has been changed to the following.
ARConfiguration.WorldAlignment.gravityandHeading
On visionOS, my app works fine when fetching CKRecords, but crashes when it tries to fetch SwiftData. My app works fine on the iPhone and iPad Simulator.
On visionOS, my app works fine when fetching CKRecords, but crashes when it tries to fetch SwiftData. My app works fine on the iPhone and iPad Simulator.
I converted my Core Data app to SwiftData and here is how the @Model turned out with respect to my image.
@Attribute(.externalStorage) var imageData: Data?
One difference. SwiftData does history tracking automatically. Core Data does not.
All I had to do was observe the remote change notification within my view controller. I didn't need to turn on remote change notifications.
NotificationCenter.default.addObserver(self,
selector: #selector(updateView(_ :)),
name: .NSPersistentStoreRemoteChange,
object: nil)
Try this in your view controller to observe remote change notifications.
NotificationCenter.default.addObserver(self,
selector: #selector(updateView(_ :)),
name: .NSPersistentStoreRemoteChange,
object: nil)
I've converted a version of my UIKit app to use SwiftData and CloudKit from CoreData/CloudKit. It works and the apps are syncing, but I am having a problem getting a notification when the data changes so I can update my view.
Initialize your ModelConfiguration with your cloudKitContainerIdentifier.
init(
_ name: String? = nil,
schema: Schema? = nil,
url: URL,
readOnly: Bool = false,
cloudKitContainerIdentifier: String? = nil
)
See here for details.
[https://developer.apple.com/documentation/swiftdata/modelconfiguration/init(_:schema:url:readonly:cloudkitcontaineridentifier:)?changes=_2_10)
Your object is set to nil, but shouldn't it be set to ModelContext context?