ListObjectObserver
public protocol ListObjectObserver : ListObserver
Implement the ListObjectObserver protocol to observe detailed changes to a list’s object. ListObjectObservers may register themselves to a ListMonitor‘s addObserver(_:) method:
let monitor = dataStack.monitorList(
From<MyPersonEntity>(),
OrderBy(.ascending("lastName"))
)
monitor.addObserver(self)
-
listMonitor(_:Default implementationdidInsertObject: toIndexPath: sourceIdentifier: ) Notifies that an object was inserted to the specified
NSIndexPathin 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
monitorthe
ListMonitormonitoring the list being observedobjectthe entity type for the inserted object
indexPaththe new
NSIndexPathfor the inserted objectsourceIdentifieran optional identifier provided by the transaction source
-
listMonitor(_:Default implementationdidInsertObject: toIndexPath: ) Notifies that an object was inserted to the specified
NSIndexPathin the list. (Optional) The default implementation does nothing.Default Implementation
Declaration
Swift
func listMonitor( _ monitor: ListMonitor<ListEntityType>, didInsertObject object: ListEntityType, toIndexPath indexPath: IndexPath )Parameters
monitorthe
ListMonitormonitoring the list being observedobjectthe entity type for the inserted object
indexPaththe new
NSIndexPathfor the inserted object -
listMonitor(_:Default implementationdidDeleteObject: fromIndexPath: sourceIdentifier: ) Notifies that an object was deleted from the specified
NSIndexPathin 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
monitorthe
ListMonitormonitoring the list being observedobjectthe entity type for the deleted object
indexPaththe
NSIndexPathfor the deleted objectsourceIdentifieran optional identifier provided by the transaction source
-
listMonitor(_:Default implementationdidDeleteObject: fromIndexPath: ) Notifies that an object was deleted from the specified
NSIndexPathin the list. (Optional) The default implementation does nothing.Default Implementation
Declaration
Swift
func listMonitor( _ monitor: ListMonitor<ListEntityType>, didDeleteObject object: ListEntityType, fromIndexPath indexPath: IndexPath )Parameters
monitorthe
ListMonitormonitoring the list being observedobjectthe entity type for the deleted object
indexPaththe
NSIndexPathfor the deleted object -
listMonitor(_:Default implementationdidUpdateObject: atIndexPath: sourceIdentifier: ) Notifies that an object at the specified
NSIndexPathwas 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
monitorthe
ListMonitormonitoring the list being observedobjectthe entity type for the updated object
indexPaththe
NSIndexPathfor the updated objectsourceIdentifieran optional identifier provided by the transaction source
-
listMonitor(_:Default implementationdidUpdateObject: atIndexPath: ) Notifies that an object at the specified
NSIndexPathwas updated. (Optional) The default implementation does nothing.Default Implementation
Declaration
Swift
func listMonitor( _ monitor: ListMonitor<ListEntityType>, didUpdateObject object: ListEntityType, atIndexPath indexPath: IndexPath )Parameters
monitorthe
ListMonitormonitoring the list being observedobjectthe entity type for the updated object
indexPaththe
NSIndexPathfor the updated object -
listMonitor(_:Default implementationdidMoveObject: fromIndexPath: toIndexPath: sourceIdentifier: ) 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
monitorthe
ListMonitormonitoring the list being observedobjectthe entity type for the moved object
fromIndexPaththe previous
NSIndexPathfor the moved objecttoIndexPaththe new
NSIndexPathfor the moved objectsourceIdentifieran optional identifier provided by the transaction source
-
listMonitor(_:Default implementationdidMoveObject: fromIndexPath: toIndexPath: ) 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
monitorthe
ListMonitormonitoring the list being observedobjectthe entity type for the moved object
fromIndexPaththe previous
NSIndexPathfor the moved objecttoIndexPaththe new
NSIndexPathfor the moved object
View on GitHub
ListObjectObserver Protocol Reference