# CSListObserver Protocol Reference

# CSListObserver

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

Implement the `CSListObserver` protocol to observe changes to a list of `NSManagedObject`s. `CSListObserver`s may register themselves to a `CSListMonitor`‘s `-addListObserver:` method:

    CSListMonitor *monitor = [CSCoreStore
        monitorListFrom:[CSFrom entityClass:[MyPersonEntity class]]
        fetchClauses:@[[CSOrderBy sortDescriptor:[CSSortKey withKeyPath:@"lastName" ascending:YES]]]];
    [monitor addListObserver:self];

See also

`ListObserver`

- `listMonitorWillChange(_:)`

  Handles processing just before a change to the observed list occurs

  #### Declaration

  Swift

      @objc
      optional func listMonitorWillChange(_ monitor: CSListMonitor)

  #### Parameters

  `monitor` | the `CSListMonitor` monitoring the list being observed

- `listMonitorDidChange(_:)`

  Handles processing right after a change to the observed list occurs

  #### Declaration

  Swift

      @objc
      optional func listMonitorDidChange(_ monitor: CSListMonitor)

  #### Parameters

  `monitor` | the `CSListMonitor` monitoring the object being observed

- `listMonitorWillRefetch(_:)`

  This method is broadcast from within the `CSListMonitor`‘s `-refetchWithFetchClauses:` method to let observers prepare for the internal `NSFetchedResultsController`’s pending change to its predicate, sort descriptors, etc. Note that the actual refetch will happen after the `NSFetchedResultsController`’s last `-controllerDidChangeContent:` notification completes.

  #### Declaration

  Swift

      @objc
      optional func listMonitorWillRefetch(_ monitor: CSListMonitor)

  #### Parameters

  `monitor` | the `CSListMonitor` monitoring the object being observed

- `listMonitorDidRefetch(_:)`

  After the `CSListMonitor`‘s `-refetchWithFetchClauses:` method is called, this method is broadcast after the `NSFetchedResultsController`’s last `-controllerDidChangeContent:` notification completes.

  #### Declaration

  Swift

      @objc
      optional func listMonitorDidRefetch(_ monitor: CSListMonitor)

  #### Parameters

  `monitor` | the `CSListMonitor` monitoring the object being observed