Skip to main content

iOS SDK

Drop-in Swift package for the WIDTH verification flow. UIKit and SwiftUI entry points, optional event logging.

Requirements

RequirementMinimum
Xcode16+
iOS16.0+
Package ManagerSwift Package Manager

Integration

1. Add the package

Copy the SDK directory (Package.swift + three xcframeworks) to vendor/WidthIdentitySDK/.

In Xcode: File → Add Package Dependencies… → Add Local…, select vendor/WidthIdentitySDK. In the app target's Frameworks, Libraries, and Embedded Content, add WidthIdentity with Embed & Sign.

2. Add Info.plist permissions

<key>NSCameraUsageDescription</key>
<string>Used to capture identity documents and complete the liveness check.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Used to select identity document images.</string>

Present the verification flow

UIKit

import UIKit
import WidthIdentity

final class ViewController: UIViewController {
  func startVerification() throws {
    let input = try VerificationInput(
      credentials: CredentialsConfig(
        appId:    "YOUR_APP_ID",
        apiKey:   "YOUR_API_KEY",
        domain:   "YOUR_DOMAIN",
        sdkToken: "YOUR_SDK_TOKEN"
      ),
      customer: CustomerConfig(
        customerId: "user-123",
        email:      "user@example.com"
      )
    )

    WidthVerification.present(from: self, input: input) { result in
      switch result {
      case .completed(let id, let decision): print("done:", id, decision)
      case .waiting(let id):                  print("waiting:", id)
      case .cancelled:                        print("cancelled")
      case .failed(let code, let message, _): print("failed:", code, message)
      }
    }
  }
}

SwiftUI

import SwiftUI
import WidthIdentity

struct ContentView: View {
  @State private var presenting = false
  let input: VerificationInput

  var body: some View {
    Button("Verify") { presenting = true }
      .widthVerification(isPresented: $presenting, input: input) { result in
        // handle result
      }
  }
}

Event logging

class MyCrashlyticsLogger: SdkEventLogger {
  func onEvent(level: SdkLogLevel, tag: String, message: String, error: Error?) {
    Crashlytics.crashlytics().log("[\(level)] \(tag): \(message)")
  }
}

let input = try VerificationInput(
  credentials: ...,
  customer: ...,
  eventLogger: MyCrashlyticsLogger()
)

Public API

SymbolPurpose
WidthVerification.present(from:input:completion:)UIKit entry
View.widthVerification(isPresented:input:onResult:)SwiftUI entry
VerificationInput / CredentialsConfig / CustomerConfigInputs
VerificationResult / VerificationDecisionResult
ThemeConfig / ThemeModeOptional theme
WidthSDKErrorError codes
SdkEventLogger / SdkLogLevelOptional event logging

Notes

Support. For integration questions, contact long@width.com.