ContextNotification

public struct ContextNotification<T> where T : NSManagedObject

Wrapper around a Notification from an NSManagedObjectContext that offers type-checked access to various attributes from the Notification payload.

NOTE: as Apple’s documentation states:

You can only use the managed objects in this notification on the same thread on which it was posted.

  • Obtain an iterator over the objects that have been inserted.

    Declaration

    Swift

    public var insertedObjects: AnyIterator<T> { get }
  • Obtain an iterator over the objects that have been updated.

    Declaration

    Swift

    public var updatedObjects: AnyIterator<T> { get }
  • Obtain an iterator over the objects that have been deleted.

    Declaration

    Swift

    public var deletedObjects: AnyIterator<T> { get }
  • Get the managed object context from the notification payload.

    Declaration

    Swift

    public var managedObjectContext: NSManagedObjectContext { get }
  • Create wrapper for the given notification. The notification’s name must be .NSManagedObjectContextDidSave.

    Declaration

    Swift

    public init(notification: Notification)

    Parameters

    notification

    the object to wrap