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
SELECT
query, otherwise a store error withqueryNotSupported
reason is thrown.Throws
DittoSwiftError
>.storeError(.queryInvalid)
ifquery
string is not valid DQL.Throws
DittoSwiftError
>.storeError(.queryArgumentsInvalid)
ifarguments
dictionary is not valid (contains unsupported types).Throws
DittoSwiftError
>.storeError(.queryNotSupported)
if query is not aSELECT
query.Throws
May throw other
DittoSwiftError
s.Declaration
Swift
@discardableResult public func registerSubscription( query: String, arguments: Dictionary<String, Any?>? = nil ) throws -> DittoSyncSubscription
Return Value
An active
SyncSubscription
for 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 owningDitto
object goes out of scope.