CBLLiveQuery

@interface CBLLiveQuery : NSObject

A CBLLiveQuery automatically observes database changes and re-run the query that the CBLLiveQuery object is created from. If there is a new query result or an error occurred, the CBLLiveQuery will report the changed result via the added listener blocks.

  • Starts observing database changes and reports changes in the query result.

    Declaration

    Objective-C

    - (void)run;
  • Stops observing database changes.

    Declaration

    Objective-C

    - (void)stop;
  • Adds a query result change listener block. - parameter: block a change listener block - returns: the opaque listener object used for removing the added change listener block.

    Declaration

    Objective-C

    - (nonnull id<NSObject>)addChangeListener:
        (nonnull void (^)(CBLLiveQueryChange *_Nonnull))block;

    Parameters

    block
  • Removed a change listener. - parameter: listener a listener object received when adding the change listener block.

    Declaration

    Objective-C

    - (void)removeChangeListener:(nonnull id<NSObject>)listener;

    Parameters

    listener