# ListObjectObserver

    public protocol ListObjectObserver : ListObserver

Implement the `ListObjectObserver` protocol to observe detailed changes to a list’s object. `ListObjectObserver`s may register themselves to a `ListMonitor`‘s `addObserver(_:)` method:

    let monitor = dataStack.monitorList(
        From<MyPersonEntity>(),
        OrderBy(.ascending("lastName"))
    )
    monitor.addObserver(self)

- `listMonitor(_:didInsertObject:toIndexPath:sourceIdentifier:)` Default implementation

  Notifies that an object was inserted to the specified `NSIndexPath` in the list. (Optional) The default implementation does nothing.

  #### Default Implementation

  #### Declaration

  Swift

      func listMonitor(
          _ monitor: ListMonitor<ListEntityType>,
          didInsertObject object: ListEntityType,
          toIndexPath indexPath: IndexPath,
          sourceIdentifier: Any?
      )

  #### Parameters

  `monitor` | the `ListMonitor` monitoring the list being observed
  `object` | the entity type for the inserted object
  `indexPath` | the new `NSIndexPath` for the inserted object
  `sourceIdentifier` | an optional identifier provided by the transaction source

- `listMonitor(_:didInsertObject:toIndexPath:)` Default implementation

  Notifies that an object was inserted to the specified `NSIndexPath` in the list. (Optional) The default implementation does nothing.

  #### Default Implementation

  #### Declaration

  Swift

      func listMonitor(
          _ monitor: ListMonitor<ListEntityType>,
          didInsertObject object: ListEntityType,
          toIndexPath indexPath: IndexPath
      )

  #### Parameters

  `monitor` | the `ListMonitor` monitoring the list being observed
  `object` | the entity type for the inserted object
  `indexPath` | the new `NSIndexPath` for the inserted object

- `listMonitor(_:didDeleteObject:fromIndexPath:sourceIdentifier:)` Default implementation

  Notifies that an object was deleted from the specified `NSIndexPath` in the list. (Optional) The default implementation does nothing.

  #### Default Implementation

  #### Declaration

  Swift

      func listMonitor(
          _ monitor: ListMonitor<ListEntityType>,
          didDeleteObject object: ListEntityType,
          fromIndexPath indexPath: IndexPath,
          sourceIdentifier: Any?
      )

  #### Parameters

  `monitor` | the `ListMonitor` monitoring the list being observed
  `object` | the entity type for the deleted object
  `indexPath` | the `NSIndexPath` for the deleted object
  `sourceIdentifier` | an optional identifier provided by the transaction source

- `listMonitor(_:didDeleteObject:fromIndexPath:)` Default implementation

  Notifies that an object was deleted from the specified `NSIndexPath` in the list. (Optional) The default implementation does nothing.

  #### Default Implementation

  #### Declaration

  Swift

      func listMonitor(
          _ monitor: ListMonitor<ListEntityType>,
          didDeleteObject object: ListEntityType,
          fromIndexPath indexPath: IndexPath
      )

  #### Parameters

  `monitor` | the `ListMonitor` monitoring the list being observed
  `object` | the entity type for the deleted object
  `indexPath` | the `NSIndexPath` for the deleted object

- `listMonitor(_:didUpdateObject:atIndexPath:sourceIdentifier:)` Default implementation

  Notifies that an object at the specified `NSIndexPath` was updated. (Optional) The default implementation does nothing.

  #### Default Implementation

  #### Declaration

  Swift

      func listMonitor(
          _ monitor: ListMonitor<ListEntityType>,
          didUpdateObject object: ListEntityType,
          atIndexPath indexPath: IndexPath,
          sourceIdentifier: Any?
      )

  #### Parameters

  `monitor` | the `ListMonitor` monitoring the list being observed
  `object` | the entity type for the updated object
  `indexPath` | the `NSIndexPath` for the updated object
  `sourceIdentifier` | an optional identifier provided by the transaction source

- `listMonitor(_:didUpdateObject:atIndexPath:)` Default implementation

  Notifies that an object at the specified `NSIndexPath` was updated. (Optional) The default implementation does nothing.

  #### Default Implementation

  #### Declaration

  Swift

      func listMonitor(
          _ monitor: ListMonitor<ListEntityType>,
          didUpdateObject object: ListEntityType,
          atIndexPath indexPath: IndexPath
      )

  #### Parameters

  `monitor` | the `ListMonitor` monitoring the list being observed
  `object` | the entity type for the updated object
  `indexPath` | the `NSIndexPath` for the updated object

- `listMonitor(_:didMoveObject:fromIndexPath:toIndexPath:sourceIdentifier:)` Default implementation

  Notifies that an object’s index changed. (Optional) The default implementation does nothing.

  #### Default Implementation

  #### Declaration

  Swift

      func listMonitor(
          _ monitor: ListMonitor<ListEntityType>,
          didMoveObject object: ListEntityType,
          fromIndexPath: IndexPath,
          toIndexPath: IndexPath,
          sourceIdentifier: Any?
      )

  #### Parameters

  `monitor` | the `ListMonitor` 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
  `sourceIdentifier` | an optional identifier provided by the transaction source

- `listMonitor(_:didMoveObject:fromIndexPath:toIndexPath:)` Default implementation

  Notifies that an object’s index changed. (Optional) The default implementation does nothing.

  #### Default Implementation

  #### Declaration

  Swift

      func listMonitor(
          _ monitor: ListMonitor<ListEntityType>,
          didMoveObject object: ListEntityType,
          fromIndexPath: IndexPath,
          toIndexPath: IndexPath
      )

  #### Parameters

  `monitor` | the `ListMonitor` 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