-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
extension Notification {
public struct ManagedObjectContextDidSave {
public var insertedObjects: Set<NSManagedObject> { return notification.objects(for: NSInsertedObjectsKey) }
public var updatedObjects: Set<NSManagedObject> { return notification.objects(for: NSUpdatedObjectsKey) }
public var deletedObjects: Set<NSManagedObject> { return notification.objects(for: NSDeletedObjectsKey) }
private let notification: Notification
fileprivate init(notification: Notification) {
precondition(notification.name == .NSManagedObjectContextDidSave)
self.notification = notification
}
}
public func asManagedObjectContextDidSave() -> ManagedObjectContextDidSave {
return ManagedObjectContextDidSave(notification: self)
}
}
extension Notification {
fileprivate func objects(for key: String) -> Set<NSManagedObject> {
return userInfo?[key] as! Set<NSManagedObject>? ?? []
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels