Skip to main content
Interim hand-authored reference. This page is authored from the SeamSDK public Swift sources. See the reference overview for context.

Overview

Seam is a public final class that conforms to ObservableObject. It exposes a shared singleton and the full public API for initializing the SDK, observing credentials, triggering unlocks, and tearing down the session.
public final class Seam: ObservableObject
Use cases:
  • Bootstrapping the SDK at app launch (initialize + activate).
  • Observing credentials changes reactively in SwiftUI or Combine.
  • Triggering a manual credential refresh on pull-to-refresh.
  • Unlocking a door via Combine publisher with per-attempt proximity control.
  • Cleaning up resources on logout or account switch with deactivate().

Shared Instance

shared

The shared singleton instance of Seam. Use this to interact with the SDK after initialization.
public static let shared: Seam

Type Methods

initialize(clientSessionToken:)

Sets up the SDK with the provided client session token. Must be called before any other SDK methods.
public static func initialize(clientSessionToken: String) throws
Parameters
ParameterTypeDescription
clientSessionTokenStringA valid client session token string.
Throws
ErrorDescription
SeamError.invalidClientSessionTokenThe provided token is malformed or invalid.
SeamError.deactivationInProgressA deactivation operation is already running.
SeamError.alreadyInitializedThe SDK is already initialized without prior deactivation.
Notes
  • Initializing without a token will attempt to use the previous session if still valid.
  • Thread-safe: can be invoked from any thread.
  • To reinitialize, call deactivate(deintegrate:) first.
try Seam.initialize(clientSessionToken: "your_token")

Instance Properties

credentials

A published list of current credentials, automatically synchronized in the background.
@Published public private(set) var credentials: [SeamCredential]
Subscribe to this property to observe changes and update your UI or business logic. Credentials are automatically kept up-to-date as changes occur. Call refresh() to trigger an explicit sync (for example, on pull-to-refresh). See also: SeamCredential, refresh()

isActive

A published Boolean indicating whether the SDK is currently active.
@Published public private(set) var isActive: Bool
Use this to enable or disable UI or logic depending on whether Seam is active.

Instance Methods

activate()

Starts the SDK to begin credential synchronization and processing.
public func activate() async throws
Throws
ErrorDescription
SeamError.initializationRequiredinitialize(clientSessionToken:) has not been called.
SeamError.deactivationInProgressA deactivation operation is in progress.
await Seam.shared.activate()

refresh()

Requests the latest credential list and updates the published credentials property.
public func refresh() async throws -> [SeamCredential]
Returns: An array of refreshed SeamCredential values. Throws
ErrorDescription
SeamError.initializationRequiredThe SDK has not been initialized.
SeamError.deactivationInProgressA deactivation operation is in progress.
Note: Credentials are automatically synchronized in the background — calling refresh() is optional and intended for explicit user-initiated sync (for example, pull-to-refresh UI).
Task {
    do {
        let updatedCredentials = try await Seam.shared.refresh()
    } catch {
        // Handle refresh errors
    }
}

unlock(using:proximity:timeout:)

Unlocks a door or device using the given credential ID.
public func unlock(
    using credentialId: String,
    proximity: SeamUnlockProximity? = nil,
    timeout: TimeInterval = 10.0
) throws -> AnyPublisher<SeamUnlockEvent, Never>
Parameters
ParameterTypeDefaultDescription
credentialIdStringThe ID of the credential to use.
proximitySeamUnlockProximity?nilRequired proximity for this attempt. If nil, uses the credential’s default (the first value in SeamCredential.supportedUnlockProximities).
timeoutTimeInterval10.0Maximum seconds to wait for the unlock operation.
Returns: A Combine publisher emitting SeamUnlockEvent values as the operation progresses. Throws
ErrorDescription
SeamError.initializationRequiredinitialize(clientSessionToken:) has not been called.
SeamError.invalidCredentialIdNo credential matches the provided identifier.
SeamError.integrationNotFoundThe lock provider integration for the credential is not configured.
SeamError.credentialErrors([SeamCredentialError])The credential has one or more associated errors.
// Use the credential's default proximity
let publisher = try Seam.shared.unlock(using: credential.id)

// Require on-site Bluetooth proximity
let publisher = try Seam.shared.unlock(using: credential.id, proximity: .nearby)

// Require tap/at-reader proximity
let publisher = try Seam.shared.unlock(using: credential.id, proximity: .touch)
See also: SeamUnlockProximity, SeamUnlockEvent, SeamCredential.supportedUnlockProximities

deactivate(deintegrate:)

Stops the SDK and releases resources, optionally removing device association.
public func deactivate(deintegrate: Bool = false) async
Parameters
ParameterTypeDefaultDescription
deintegrateBoolfalseIf true, performs full deintegration and removes device endpoints. If false, logs out but retains device endpoints.
Notes
  • initialize() must have been called first.
  • Safe to call multiple times; idle calls are no-ops.
await Seam.shared.deactivate()

// Full deintegration on account removal:
await Seam.shared.deactivate(deintegrate: true)