WCQuery

@interface WCQuery : NSObject

A WCQuery object sorts and filters data at a Webcom location.

Can order and restrict data to a smallest subset.

Queries can be chained easily with filter functions. They return WCQuery objects.

  • ref

    The query reference for the location that generated this query.

    Declaration

    Objective-C

    @property (readonly, nonatomic) WCQuery *_Nonnull ref;

    Swift

    var ref: WCQuery { get }
  • The identifier of the query containing query criteria.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull queryIdentifier;

    Swift

    var queryIdentifier: String { get }
  • The serialized query object.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSDictionary *_Nonnull queryObject;

    Swift

    var queryObject: [AnyHashable : Any] { get }
  • Observes data changes only once at current Webcom reference location.

    Declaration

    Objective-C

    - (void)onceEventType:(WCEventType)type
             withCallback:(nonnull void (^)(WCDataSnapshot *_Nullable,
                                            NSString *_Nullable))callback;

    Swift

    func onceEventType(_ type: WCEventType, withCallback callback: @escaping (WCDataSnapshot?, String?) -> Void)

    Parameters

    type

    The type of event to be observed.

    callback

    A block called when the observed event occurs.

  • Observes data changes only once at current Webcom reference location.

    Declaration

    Objective-C

    - (void)onceEventType:(WCEventType)type
             withCallback:(nonnull void (^)(WCDataSnapshot *_Nullable,
                                            NSString *_Nullable))callback
        andCancelCallback:(nullable void (^)(NSError *_Nullable))cancelCallback;

    Swift

    func onceEventType(_ type: WCEventType, withCallback callback: @escaping (WCDataSnapshot?, String?) -> Void, andCancelCallback cancelCallback: ((Error?) -> Void)? = nil)

    Parameters

    type

    The type of event to be observed.

    callback

    A block called when the observed event occurs.

    cancelCallback

    A block called when the user loses read permission at this location.

  • Observes data changes at current Webcom reference location.

    Declaration

    Objective-C

    - (void)onEventType:(WCEventType)type
           withCallback:(nonnull void (^)(WCDataSnapshot *_Nullable,
                                          NSString *_Nullable))callback;

    Swift

    func onEventType(_ type: WCEventType, withCallback callback: @escaping (WCDataSnapshot?, String?) -> Void)

    Parameters

    type

    The type of event to be observed.

    callback

    A block called when the observed event occurs.

  • Observes data changes at current Webcom reference location.

    Declaration

    Objective-C

    - (void)onEventType:(WCEventType)type
             withCallback:(nonnull void (^)(WCDataSnapshot *_Nullable,
                                            NSString *_Nullable))callback
        andCancelCallback:(nullable void (^)(NSError *_Nullable))cancelCallback;

    Swift

    func onEventType(_ type: WCEventType, withCallback callback: @escaping (WCDataSnapshot?, String?) -> Void, andCancelCallback cancelCallback: ((Error?) -> Void)? = nil)

    Parameters

    type

    The type of event to be observed.

    callback

    A block called when the observed event occurs.

    cancelCallback

    A block called when the user loses read permission at this location.

  • Removes observers for data changes at current Webcom reference location.

    Declaration

    Objective-C

    - (void)offEventType:(WCEventType)type;

    Swift

    func offEventType(_ type: WCEventType)

    Parameters

    type

    The type of event observed.