CSListObjectObserver
@available(OSX 10.12, *)
@objc
public protocol CSListObjectObserver : CSListObserver
Implement the CSListObjectObserver
protocol to observe detailed changes to a list’s object. CSListObjectObserver
s 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
NSIndexPath
in the listDeclaration
Swift
@objc optional func listMonitor(_ monitor: CSListMonitor, didInsertObject object: Any, toIndexPath indexPath: IndexPath)
Parameters
monitor
the
CSListMonitor
monitoring the list being observedobject
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 listDeclaration
Swift
@objc optional func listMonitor(_ monitor: CSListMonitor, didDeleteObject object: Any, fromIndexPath indexPath: IndexPath)
Parameters
monitor
the
CSListMonitor
monitoring the list being observedobject
the entity type for the deleted object
indexPath
the
NSIndexPath
for the deleted object -
Notifies that an object at the specified
NSIndexPath
was updatedDeclaration
Swift
@objc optional func listMonitor(_ monitor: CSListMonitor, didUpdateObject object: Any, atIndexPath indexPath: IndexPath)
Parameters
monitor
the
CSListMonitor
monitoring the list being observedobject
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 observedobject
the entity type for the moved object
fromIndexPath
the previous
NSIndexPath
for the moved objecttoIndexPath
the new
NSIndexPath
for the moved object