CBLLiveQuery

@interface CBLLiveQuery : CBLQuery

A CBLQuery subclass that automatically refreshes the result rows every time the database changes. All you need to do is use KVO to observe changes to the .rows property.

  • The shortest interval at which the query will update, regardless of how often the database changes. Defaults to 0.2 sec. Increase this if the query is expensive and the database updates frequently, to limit CPU consumption.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) NSTimeInterval updateInterval;
  • Starts observing database changes. The .rows property will now update automatically. (You usually don’t need to call this yourself, since accessing or observing the .rows property will call -start for you.)

    Declaration

    Objective-C

    - (void)start;
  • Stops observing database changes. Calling -start or .rows will restart it.

    Declaration

    Objective-C

    - (void)stop;
  • The current query results; this updates as the database changes, and can be observed using KVO. Its value will be nil until the initial asynchronous query finishes.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSArray<CBLQueryRow *> *rows;
  • If non-nil, the error of the last execution of the query. If nil, the last execution of the query was successful.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSError *lastError;