Skip to main content

iOS SDK

The Kora IDV iOS SDK provides a complete verification UI — document capture, selfie, and liveness detection — built with UIKit and SwiftUI support.

Requirements

  • iOS 14.0+
  • Xcode 14.0+
  • Swift 5.7+

Installation

CocoaPods

# Podfile
pod 'KoraIDV', :git => 'https://github.com/badedokun/koraidv-koraidv-ios.git', :tag => 'v1.5.0'
pod install

Swift Package Manager

Add the package in Xcode:

  1. File → Add Package Dependencies
  2. Enter the repository URL: https://github.com/badedokun/koraidv-koraidv-ios
  3. Select version 1.5.0 or later

Or add to your Package.swift:

dependencies: [
.package(url: "https://github.com/badedokun/koraidv-koraidv-ios.git", from: "1.5.0")
]

Quick start

1. Configure the SDK

import KoraIDV

// In your AppDelegate or app initialization
KoraIDV.configure(with: Configuration(
apiKey: "kora_sandbox_xxxxx",
tenantId: "your-tenant-uuid",
environment: .sandbox
))

2. Start a verification

The SDK creates the verification for you — pass your own externalId and a tier:

KoraIDV.startVerification(
externalId: "user-\(userId)",
tier: .standard,
presenting: self
) { result in
switch result {
case .success(let verification):
let status = verification.status
let riskScore = verification.riskScore ?? 0 // 0–100
let imagePersisted = verification.imagePersisted
// Handle success

case .failure(let error):
// Handle error
print(error.localizedDescription)

case .cancelled:
// User dismissed the flow
break
}
}

VerificationTier accepts: .basic, .standard, .enhanced. (See tier table.)

Verification tiers

TierIncludes
.basicDocument OCR + basic authenticity
.standard+ Face match + active liveness
.enhanced+ Anti-spoof + risk signals + compliance screening (sanctions / PEP / adverse media)

Resume an existing verification

If you have a verificationId from a webhook or previous attempt:

KoraIDV.resumeVerification(
verificationId: existingVerificationId,
presenting: self
) { result in
// Handle result
}

Configuration options

ParameterTypeDefaultDescription
apiKeyStringRequiredYour API key (kora_sandbox_… for sandbox, kora_live_… for production)
tenantIdStringRequiredYour tenant UUID
environmentAPIEnvironment.sandbox.sandbox or .production (auto-detected from API key prefix; explicit setting overrides)
baseURLURL?nilOverride base URL (for on-premise deployments)
themeKoraThemeDefaultsCustom theme colors and styling
livenessModeLivenessMode.active.active (challenges) or .passive (auto-detect)
timeoutTimeInterval120Network request timeout in seconds
debugLoggingBoolfalseVerbose logs

Theme customization

let theme = KoraTheme(
primaryColor: UIColor.systemBlue,
backgroundColor: UIColor.systemBackground,
textColor: UIColor.label,
errorColor: UIColor.systemRed,
cornerRadius: 12,
buttonHeight: 48
)

KoraIDV.configure(
apiKey: "test_your_api_key",
tenantId: "your-tenant-uuid",
theme: theme
)

Error handling

case .failure(let error):
switch error.code {
case .networkError:
// Check internet connection
showRetryAlert(message: error.message)

case .cameraAccessDenied:
// Prompt user to enable camera in Settings
openSettings()

case .sessionExpired:
// Create a new verification on your server
createNewVerification()

case .userCancelled:
// User dismissed the verification
break
}
Error CodeDescriptionRecovery
.networkErrorNetwork request failedCheck connection, retry
.cameraAccessDeniedCamera permission not grantedOpen Settings, request permission
.sessionExpiredVerification session timed outCreate a new verification
.userCancelledUser dismissed the UIPrompt to try again

Privacy permissions

Add to your Info.plist:

<key>NSCameraUsageDescription</key>
<string>Camera access is required to capture your identity document and selfie for verification.</string>

Troubleshooting

Environment naming conflict

If you have another Environment type in your project, use the fully qualified name:

KoraIDV.configure(
apiKey: "test_your_api_key",
tenantId: "your-tenant-uuid",
environment: KoraIDV.APIEnvironment.sandbox
)

Deployment target mismatch

Ensure your project's minimum deployment target is iOS 14.0 or higher. In Xcode: Project → General → Minimum Deployments.

CocoaPods cache issues

pod cache clean KoraIDV --all
pod deintegrate
pod install

Flutter bridge

If your iOS host is part of a Flutter app:

// In your AppDelegate
let controller = window?.rootViewController as! FlutterViewController
let channel = FlutterMethodChannel(
name: "com.yourapp/koraidv",
binaryMessenger: controller.binaryMessenger
)

channel.setMethodCallHandler { call, result in
if call.method == "startVerification" {
let args = call.arguments as! [String: Any]
let verificationId = args["verificationId"] as! String

KoraIDV.startVerification(
verificationId: verificationId,
presenting: controller
) { verificationResult in
switch verificationResult {
case .success(let v):
result(["status": v.status.rawValue, "riskScore": v.riskScore ?? NSNull()])
case .failure(let error):
result(FlutterError(
code: "VERIFICATION_ERROR",
message: error.message,
details: nil
))
}
}
}
}