SubscriptionCallback
open class SubscriptionCallback<T> : QuerySubscribable where T : ParseObject
A default implementation of the QuerySubscribable
protocol using closures for callbacks.
-
Declaration
Swift
public var query: Query<T>
-
Declaration
Swift
public typealias Object = T
-
Creates a new subscription that can be used to handle updates.
Declaration
Swift
public required init(query: Query<T>)
-
Register a callback for when a client successfully subscribes to a query.
Declaration
Swift
@discardableResult open func handleSubscribe(_ handler: @escaping (Query<T>, Bool) -> Void) -> SubscriptionCallback
Parameters
handler
The callback to register.
Return Value
The same subscription, for easy chaining.
-
Register a callback for when a query has been unsubscribed.
Declaration
Swift
@discardableResult open func handleUnsubscribe(_ handler: @escaping (Query<T>) -> Void) -> SubscriptionCallback
Parameters
handler
The callback to register.
Return Value
The same subscription, for easy chaining.
-
Register a callback for when an event occurs of a specific type Example: subscription.handle(Event.Created) { query, object in // Called whenever an object is creaated }
Declaration
Parameters
eventType
The event type to handle. You should pass one of the enum cases in
Event
.handler
The callback to register.
Return Value
The same subscription, for easy chaining.
-
Declaration
Swift
open func didReceive(_ eventData: Data) throws
-
Declaration
Swift
open func didSubscribe(_ new: Bool)
-
Declaration
Swift
open func didUnsubscribe()