Stitch

public class Stitch

Stitch is the singleton class with static utility functions for initializing the SDK.

Use it to initialize and retrieve a StitchAppClient for your Stitch app.

  • Initializes the default StitchAppClient associated with the application.

    Throws

    A StitchInitializationError if the provided configuation is missing a client app id, if a default app client has already been initialized, or the provided configuration contains a client app id for which a non-default StitchAppClient has already been created.

    Declaration

    Swift

    public static func initializeDefaultAppClient(
        withClientAppID clientAppID: String,
        withConfig config: StitchAppClientConfiguration = StitchAppClientConfigurationBuilder().build()
    ) throws -> StitchAppClient

    Parameters

    withConfigBuilder

    a StitchAppClientConfigurationBuilder containing the configuration desired for the default StitchAppClient.

    Return Value

    A StitchAppClient configured with the provided configuration.

  • Initializes a new, non-default StitchAppClient associated with the application.

    Throws

    A StitchInitializationError if the provided configuation is missing a client app id, or if an app client has already been initialized for the client app id in the provided configuration.

    Declaration

    Swift

    public static func initializeAppClient(
        withClientAppID clientAppID: String,
        withConfig config: StitchAppClientConfiguration = StitchAppClientConfigurationBuilder().build()
    ) throws -> StitchAppClient

    Parameters

    withConfigBuilder

    a StitchAppClientConfigurationBuilder containing the configuration desired for the new StitchAppClient.

    Return Value

    A StitchAppClient configured with the provided configuration.

  • Retrieves the default StitchAppClient associated with the application.

    Declaration

    Swift

    public static var defaultAppClient: StitchAppClient? { get }

    Return Value

    A StitchAppClient with the configuration specified when initializeDefaultAppClient(:withConfigBuilder) was called. If initialize() was never called, or if initializeDefaultAppClient was never called, this will return nil.

  • Retrieves the StitchAppClient associated with the provided client app id.

    Throws

    A StitchInitializationError if initialize() was never called, or if initializeAppClient(:withConfigBuilder) was never called with a configuration that created a client for the provided client app id.

    Declaration

    Swift

    public static func appClient(forAppID appID: String) throws -> StitchAppClient

    Parameters

    forAppID

    The client app id of the app client to be retrieved.

    Return Value

    A StitchAppClient with the configuration specified when initializeAppClient(:withConfigBuilder) was called with a configuration that created a client for the provided client app id.