CBLCollectionChangeObservable

@protocol CBLCollectionChangeObservable <NSObject>

The CollectionChangeObservable interface represents the object that can notify change events that occur to documents in collections.

  • Add a change listener to listen to change events occurring to any documents in the collection. To remove the listener, call remove() function on the returned listener token.

    If the collection is deleted or the database is closed, a warning message will be logged.

    Declaration

    Objective-C

    - (nonnull id<CBLListenerToken>)addChangeListener:
        (nonnull void (^)(CBLCollectionChange *_Nonnull))listener;

    Parameters

    listener

    The listener to post the changes.

    Return Value

    An opaque listener token object for removing the listener

  • Add a change listener to listen to change events occurring to any documents in the collection. If a dispatch queue is given, the events will be posted on the dispatch queue. To remove the listener, call remove() function on the returned listener token.

    If the collection is deleted or the database is closed, a warning message will be logged.

    Declaration

    Objective-C

    - (nonnull id<CBLListenerToken>)
        addChangeListenerWithQueue:(nullable dispatch_queue_t)queue
                          listener:(nonnull void (^)(CBLCollectionChange *_Nonnull))
                                       listener;

    Parameters

    queue

    The dispatch queue.

    listener

    The listener to post changes.

    Return Value

    An opaque listener token object for removing the listener