DittoAuthenticationProvider

public struct DittoAuthenticationProvider
extension DittoAuthenticationProvider: Hashable
extension DittoAuthenticationProvider: Equatable
extension DittoAuthenticationProvider: RawRepresentable

Encapsulates the authentication provider used to login.

Important

This API is in preview and provides a type-safe struct for specifying authentication providers, using the extensible-enum pattern. Supports both built-in and custom providers in a consistent and ergonomic way in v5.

This struct implements the “extensible enum” pattern, allowing for convenient and type-safe definition and use of authentication providers.

To define a custom authentication provider, extend this type and add a static property returning your custom provider:

extension DittoAuthenticationProvider {
    static var mySpecialProvider: DittoAuthenticationProvider {
        DittoAuthenticationProvider("my-special-provider")
    }
}

Then use it conveniently with the login APIs like so:

ditto.auth.login(token: ..., provider: .mySpecialProvider)
  • The built-in development authentication provider to be used together with development authentication tokens.

    Declaration

    Swift

    public static var development: DittoAuthenticationProvider { get }
  • The raw underlying authentication provider as string.

    Declaration

    Swift

    public var rawValue: String
  • Initializes a new authentication provider from a string.

    Declaration

    Swift

    public init(_ string: String)

RawRepresentable