Other Type Aliases
The following type aliases are available globally.
-
DittoAuthenticationExpirationHandlerAsynchronousA closure type that handles authentication expiration events for Ditto.
Important
This API is in preview and provides a modern, Swift-native alternative to the phased outDittoAuthenticationDelegateprotocol in v5.This handler is called when the authentication for a Ditto instance has or is about to expire, or if authentication has not yet occurred. It provides the relevant
Dittoinstance and the time interval (in seconds) until expiration. You can use this to login or to perform other necessary actions before authentication expires.Important
When using server connections (
server(url:)), you must set an expiration handler viaexpirationHandler. Otherwisestart()will throwDittoSwiftError/authenticationError(_:)withAuthenticationErrorReason/expirationHandlerMissing(message:)reason.Declaration
Swift
public typealias DittoAuthenticationExpirationHandler = (_ ditto: Ditto, _ timeUntilExpiration: TimeInterval) async -> VoidParameters
dittoThe
Dittoinstance whose authentication is expiring.timeUntilExpirationThe time interval, in seconds, until authentication expires.
-
DittoConnectionRequestHandlerAsynchronousA handler for connection requests from other peers.
Set a
DittoConnectionRequestHandleronDittoPresence.connectionRequestHandler()to allow or deny connection requests from other peers.Declaration
Swift
public typealias DittoConnectionRequestHandler = (_ connectionRequest: DittoConnectionRequest) async -> DittoConnectionRequestAuthorizationParameters
connectionRequestContains information about the remote peer that can be used to make an authorization decision.
Return Value
.allowif the request should be authorized,.denyotherwise. -
Undocumented
Declaration
Swift
public typealias DittoSwiftError = DittoError -
A closure that tells Ditto the observer’s handler is ready to receive another callback. This is a mechanism for handling backpressure when updates arrive faster than the handler can process them. Ditto pauses further callbacks, but continues to apply changes to the local store. If multiple relevant changes occur while paused, Ditto does not queue a callback for each change. After this closure is invoked, Ditto calls the handler once with the latest result if that result differs from the last result delivered.
Declaration
Swift
public typealias DittoSignalNext = () -> Void -
A store observation handler is called whenever an active store observer receives a new query result.
Declaration
Swift
public typealias DittoStoreObservationHandler = (_ result: DittoQueryResult) -> Void -
A store observation handler is called whenever an active store observer receives a new query result.
Call
signalNext()to signal that the handler is ready to receive the next callback from the store observer. SeeDittoSignalNextfor how this mechanism handles backpressure.Declaration
Swift
public typealias DittoStoreObservationHandlerWithSignalNext = (_ result: DittoQueryResult, _ signalNext: @escaping DittoSignalNext) -> Void
Other Type Aliases Reference