Other Type Aliases

The following type aliases are available globally.

  • A 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 out DittoAuthenticationDelegate protocol 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 Ditto instance 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 via expirationHandler. Otherwise start() will throw DittoSwiftError/authenticationError(_:) with AuthenticationErrorReason/expirationHandlerMissing(message:) reason.

    Declaration

    Swift

    public typealias DittoAuthenticationExpirationHandler =
        (_ ditto: Ditto, _ timeUntilExpiration: TimeInterval) async -> Void

    Parameters

    ditto

    The Ditto instance whose authentication is expiring.

    timeUntilExpiration

    The time interval, in seconds, until authentication expires.

  • A handler for connection requests from other peers.

    Set a DittoConnectionRequestHandler on DittoPresence.connectionRequestHandler() to allow or deny connection requests from other peers.

    Declaration

    Swift

    public typealias DittoConnectionRequestHandler = (_ connectionRequest: DittoConnectionRequest) async -> DittoConnectionRequestAuthorization

    Parameters

    connectionRequest

    Contains information about the remote peer that can be used to make an authorization decision.

    Return Value

    .allow if the request should be authorized, .deny otherwise.

  • Undocumented

    Declaration

    Swift

    public typealias DittoSwiftError = DittoError
  • Undocumented

    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.

    Declaration

    Swift

    public typealias DittoStoreObservationHandlerWithSignalNext = (_ result: DittoQueryResult, _ signalNext: @escaping DittoSignalNext) -> Void