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
ParseLiveQuery
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:- If you want to become a
ParseLiveQueryDelegate
to respond to authentification challenges and/or receive metrics and error messages for aParseLiveQuery
client. - You have specific LiveQueries that need to subscribe to a server that have a different url than the default.
- 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 the
ParseLiveQuery
server. When an instance is deinitialized it will automatically close it’s connection gracefully.
Declaration
Swift
public final class ParseLiveQuery : NSObject
- If you want to become a
-
A default implementation of the
See moreQuerySubscribable
protocol. Suitable forObjectObserved
as the subscription can be used as a SwiftUI publisher. Meaning it can serve indepedently as a ViewModel in MVVM. Also can be used as a Combine publisher. See Apple’s documentation for more details.Declaration
Swift
open class Subscription<T> : QueryViewModel<T>, QuerySubscribable where T : ParseObject
-
A default implementation of the
See moreQuerySubscribable
protocol using closures for callbacks.Declaration
Swift
open class SubscriptionCallback<T> : QuerySubscribable where T : ParseObject
-
A default implementation of the
See moreCloudCodeObservable
protocol. Suitable forObjectObserved
and can be used as a SwiftUI view model. Also can be used as a Combine publisher. See Apple’s documentation for more details.Declaration
Swift
open class CloudViewModel<T> : CloudObservable where T : ParseCloud
-
A default implementation of the
See moreQueryObservable
protocol. Suitable forObjectObserved
and can be used as a SwiftUI view model. Also can be used as a Combine publisher. See Apple’s documentation for more details.Declaration
Swift
open class QueryViewModel<T> : QueryObservable where T : ParseObject