LCLiveQuery

Objective-C

@interface LCLiveQuery : NSObject

Swift

class LCLiveQuery : NSObject

A type that defines an object which can observe various kinds of change events of objects that a query matches.

  • The delegate which receive change event of objects which the query matches.

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<LCLiveQueryDelegate> delegate;

    Swift

    weak var delegate: LCLiveQueryDelegate? { get set }
  • The query which matches objects that you want to observe.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) LCQuery *_Nonnull query;

    Swift

    var query: LCQuery { get }
  • Initialize live query with a LCQuery object.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithQuery:(nonnull LCQuery *)query;

    Swift

    init(query: LCQuery)

    Parameters

    query

    The query which matches objects that you want to observe.

  • Subscribe change notifications for query.

    Declaration

    Objective-C

    - (void)subscribeWithCallback:(nonnull void (^)(BOOL,
                                                    NSError *_Nonnull))callback;

    Swift

    func subscribe(callback: @escaping (Bool, Error) -> Void)

    Parameters

    callback

    The callback block of subscription.

  • Unsubscribe change notifications for query.

    Declaration

    Objective-C

    - (void)unsubscribeWithCallback:(nonnull void (^)(BOOL,
                                                      NSError *_Nonnull))callback;

    Swift

    func unsubscribe(callback: @escaping (Bool, Error) -> Void)

    Parameters

    callback

    The callback block of unsubscription.