Skip to main content
Docs

Clerk

Clerk is the main entry point for the SDK. After you configure the SDK, you can access it in two ways:

SwiftUI

After you inject Clerk.shared into the environment, you can access it with @Environment(Clerk.self).

import ClerkKit
import SwiftUI

struct ContentView: View {
  @Environment(Clerk.self) private var clerk

  var body: some View {
    if clerk.user != nil {
      Text("Signed in")
    } else {
      Text("Signed out")
    }
  }
}

Access the shared instance

If you're not using SwiftUI, you can always access Clerk through the shared instance.

let clerk = Clerk.shared

Feedback

What did you think of this content?

Last updated on

GitHubEdit on GitHub