Classes
The following classes are available globally.
-
The
ParseLiveQuery
class enables two-way communication to a Parse Live Query Server.In most cases, you should not call this class directly as a LiveQuery can be indirectly created from
Query
using:// If "Message" is a "ParseObject" let myQuery = Message.query("from" == "parse") guard let subscription = myQuery.subscribe else { "Error subscribing..." return } subscription.handleSubscribe { subscribedQuery, isNew in //Handle the subscription however you like. if isNew { print("Successfully subscribed to new query \(subscribedQuery)") } else { print("Successfully updated subscription to new query \(subscribedQuery)") } }
The above creates a
See moreParseLiveQuery
using either theliveQueryServerURL
(if it has been set) orserverURL
when usingParseSwift.initialize
. All additional queries will be created in the same way. The times you will want to initialize a newParseLiveQuery
instance are: 1) If you want to become aParseLiveQueryDelegate
to respond to authentification challenges and/or receive metrics and error messages for aParseLiveQuery
client. 2) You have specific LiveQueries that need to subscribe to a server that have a different url than the default. 3) You want to change the default url for all LiveQuery connections when the app is already running. Initializing new instances will create a new task/connection to theParseLiveQuery
server. When an instance is deinitialized it will automatically close it’s connection gracefully.Declaration
Swift
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) public final class ParseLiveQuery : NSObject
-
A default implementation of the
See moreParseSubscription
protocol. Suitable forObjectObserved
as the subscription can be used as a SwiftUI publisher. Meaning it can serve indepedently as a ViewModel in MVVM.Declaration
Swift
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) open class Subscription<T> : ParseSubscription, ObservableObject where T : ParseObject
-
A default implementation of the
See moreParseSubscription
protocol using closures for callbacks.Declaration
Swift
open class SubscriptionCallback<T> : ParseSubscription where T : ParseObject