Get this warning compiling with ios16 b5. anyone know what this is? no warning on ios15.
Capture of 'notification' with non-sendable type 'NSNotification' in a @Sendable closure
The line it shows on is:
let myObject = notification.object as! MyObject
I also noticed that NSNotificationCenter notifications in general seem to have broken in iOS16 betas. Are they getting removed?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Anyone know the SwiftData equivalet of the CoreData lifecycle methods. and how do we override them or do something similar? eg:
awakeFromInsert()
willSave()
didSave()
willTurnIntoFault()
prepareForDeletion()
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
wwdc2023-10154
wwdc2023-10189
wwdc2023-10195
SwiftData
anyone know how to use the new swift concurrency model (ie. await context.perform and context.perform) core data willSave()?
for example. how would I ensure this is thread safe? changing self.managedObjectContext!.performAndWait to await self.managedObjectContext!.perform means I have to change willSave() to async which then means it never gets called because its not overriding the correct method anymore.
override public func willSave() {
self.managedObjectContext!.performAndWait {
if self.modifiedDate == nil || Date().timeIntervalSince(self.modifiedDate!) >= 1 {
self.modifiedDate = Date()
}
}
super.willSave()
}