DittoSync
public class DittoSync
Provides access to sync related functionality of Ditto.
-
Returns all currently active sync subscriptions.
Declaration
Swift
public private(set) var subscriptions: Set<DittoSyncSubscription> { get } -
Installs and returns a sync subscription for a query, configuring Ditto to receive updates from other peers for documents matching that query. The passed in query must be a
SELECTquery, otherwise a store error withqueryNotSupportedreason is thrown.Throws
DittoSwiftError>.storeError(.queryInvalid)ifquerystring is not valid DQL.Throws
DittoSwiftError>.storeError(.queryArgumentsInvalid)ifargumentsdictionary is not valid (contains unsupported types).Throws
DittoSwiftError>.storeError(.queryNotSupported)if query is not aSELECTquery.Throws
May throw other
DittoSwiftErrors.Declaration
Swift
@discardableResult public func registerSubscription( query: String, arguments: Dictionary<String, Any?>? = nil ) throws -> DittoSyncSubscriptionReturn Value
An active
SyncSubscriptionfor the passed in query and arguments. You’ll have to keep it to be able to cancel the sync subscription. Otherwise it will remain active until the owningDittoobject goes out of scope.