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];
See also
ListObjectObserver
-
Notifies that an object was inserted to the specified
NSIndexPathin the listDeclaration
Swift
@objc optional func listMonitor(_ monitor: CSListMonitor, didInsertObject object: Any, toIndexPath indexPath: IndexPath)Parameters
monitorthe
CSListMonitormonitoring the list being observedobjectthe entity type for the inserted object
indexPaththe new
NSIndexPathfor the inserted object -
Notifies that an object was deleted from the specified
NSIndexPathin the listDeclaration
Swift
@objc optional func listMonitor(_ monitor: CSListMonitor, didDeleteObject object: Any, fromIndexPath indexPath: IndexPath)Parameters
monitorthe
CSListMonitormonitoring the list being observedobjectthe entity type for the deleted object
indexPaththe
NSIndexPathfor the deleted object -
Notifies that an object at the specified
NSIndexPathwas updatedDeclaration
Swift
@objc optional func listMonitor(_ monitor: CSListMonitor, didUpdateObject object: Any, atIndexPath indexPath: IndexPath)Parameters
monitorthe
CSListMonitormonitoring the list being observedobjectthe entity type for the updated object
indexPaththe
NSIndexPathfor 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
monitorthe
CSListMonitormonitoring the list being observedobjectthe entity type for the moved object
fromIndexPaththe previous
NSIndexPathfor the moved objecttoIndexPaththe new
NSIndexPathfor the moved object
View on GitHub
CSListObjectObserver Protocol Reference