# CSObjectObserver

    @available(OSX 10.12, *)
    @objc
    public protocol CSObjectObserver : AnyObject

Implement the `CSObjectObserver` protocol to observe changes to a single `NSManagedObject` instance. `CSObjectObserver`s may register themselves to a `CSObjectMonitor`‘s `-addObjectObserver:` method:

    CSObjectMonitor *monitor = [CSCoreStore monitorObject:myObject];
    [monitor addObjectObserver:self];

See also

`ObjectObserver`

- `objectMonitor(_:willUpdateObject:)`

  Handles processing just before a change to the observed `object` occurs

  #### Declaration

  Swift

      @objc
      optional func objectMonitor(_ monitor: CSObjectMonitor, willUpdateObject object: Any)

  #### Parameters

  `monitor` | the `CSObjectMonitor` monitoring the object being observed
  `object` | the `NSManagedObject` instance being observed

- `objectMonitor(_:didUpdateObject:changedPersistentKeys:)`

  Handles processing right after a change to the observed `object` occurs

  #### Declaration

  Swift

      @objc
      optional func objectMonitor(_ monitor: CSObjectMonitor, didUpdateObject object: Any, changedPersistentKeys: Set<String>)

  #### Parameters

  `monitor` | the `CSObjectMonitor` monitoring the object being observed
  `object` | the `NSManagedObject` instance being observed
  `changedPersistentKeys` | an `NSSet` of key paths for the attributes that were changed. Note that `changedPersistentKeys` only contains keys for attributes/relationships present in the persistent store, thus transient properties will not be reported.

- `objectMonitor(_:didDeleteObject:)`

  Handles processing right after `object` is deleted

  #### Declaration

  Swift

      @objc
      optional func objectMonitor(_ monitor: CSObjectMonitor, didDeleteObject object: Any)

  #### Parameters

  `monitor` | the `CSObjectMonitor` monitoring the object being observed
  `object` | the `NSManagedObject` instance being observed