> ## Documentation Index
> Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> How to install and set up the Stytch Consumer SDK in your iOS application.

<Note>This guide is for our new Kotlin Multiplatform SDK which is in **Public beta**. If you are instead looking for the stable version, please see [stytch-ios](https://github.com/stytchauth/stytch-ios) and the usage docs [here](https://stytchauth.github.io/stytch-ios/latest/StytchCore/documentation/stytchcore/).</Note>

For a full walk-through of how to get up and running with a sign-up and login flow using Stytch, check out our [Quickstart Guide](/get-started/quickstart).

<Steps>
  <Step title="Add the package">
    Add the Stytch iOS package via Swift Package Manager. In Xcode, go to **File → Add Package Dependencies** and enter the repository URL:

    ```
    https://github.com/stytchauth/stytch-ios-sdk
    ```

    Select the **StytchConsumerSDK** product and add it to your target.
  </Step>

  <Step title="Configure URL scheme">
    To handle magic links, register a custom URL scheme in your app's `Info.plist`:

    ```xml theme={null}
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>your-app-scheme</string>
            </array>
        </dict>
    </array>
    ```

    Then pass this scheme as the `loginRedirectUrl` and `signupRedirectUrl` when starting magic link flows, and handle the incoming URL in your `AppDelegate` or `SceneDelegate` by calling `stytch.authenticate(url:)`.
  </Step>

  <Step title="Create the Stytch client">
    Initialize the Stytch client with your Project's `public_token` from the [Project Overview](https://stytch.com/dashboard) of the Stytch Dashboard.

    ```swift theme={null}
    import StytchConsumerSDK

    let stytch = createStytchConsumer(configuration: .init(publicToken: "public-token-test-1234"))
    ```

    The client is a singleton — subsequent calls to `createStytchConsumer` return the same instance.
  </Step>

  <Step title="Observe authentication state">
    Subscribe to `authenticationStateFlow` to react to sign-in and sign-out events:

    ```swift theme={null}
    Task {
        for await state in stytch.authenticationStateFlow {
            // state is ConsumerAuthenticationState.Authenticated, Unauthenticated, or Loading
        }
    }
    ```
  </Step>
</Steps>
