CSListObjectObserver

@available(OSX 10.12, *)
@objc
public protocol CSListObjectObserver : CSListObserver

Implement the CSListObjectObserver protocol to observe detailed changes to a list’s object. CSListObjectObservers may register themselves to a CSListMonitor‘s -addListObjectObserver(_:) method:

CSListMonitor *monitor = [CSCoreStore
    monitorListFrom:[CSFrom entityClass:[MyPersonEntity class]]
    fetchClauses:@[[CSOrderBy sortDescriptor:[CSSortKey withKeyPath:@"lastName" ascending:YES]]]];
[monitor addListObjectObserver:self];
  • Notifies that an object was inserted to the specified NSIndexPath in the list

    Declaration

    Swift

    @objc
    optional func listMonitor(_ monitor: CSListMonitor, didInsertObject object: Any, toIndexPath indexPath: IndexPath)

    Parameters

    monitor

    the CSListMonitor monitoring the list being observed

    object

    the entity type for the inserted object

    indexPath

    the new NSIndexPath for the inserted object

  • Notifies that an object was deleted from the specified NSIndexPath in the list

    Declaration

    Swift

    @objc
    optional func listMonitor(_ monitor: CSListMonitor, didDeleteObject object: Any, fromIndexPath indexPath: IndexPath)

    Parameters

    monitor

    the CSListMonitor monitoring the list being observed

    object

    the entity type for the deleted object

    indexPath

    the NSIndexPath for the deleted object

  • Notifies that an object at the specified NSIndexPath was updated

    Declaration

    Swift

    @objc
    optional func listMonitor(_ monitor: CSListMonitor, didUpdateObject object: Any, atIndexPath indexPath: IndexPath)

    Parameters

    monitor

    the CSListMonitor monitoring the list being observed

    object

    the entity type for the updated object

    indexPath

    the NSIndexPath for the updated object

  • Notifies that an object’s index changed

    Declaration

    Swift

    @objc
    optional func listMonitor(_ monitor: CSListMonitor, didMoveObject object: Any, fromIndexPath: IndexPath, toIndexPath: IndexPath)

    Parameters

    monitor

    the CSListMonitor monitoring the list being observed

    object

    the entity type for the moved object

    fromIndexPath

    the previous NSIndexPath for the moved object

    toIndexPath

    the new NSIndexPath for the moved object