Requirements
iOS 14 or later, Xcode 15. The camera inside a WebView works from iOS 14.3.
Install
Take the ios folder from the SDK archive. In Xcode choose File → Add Package Dependencies…, press Add Local… and select that folder. Link the VeriffySDK library to your app.
Camera access
Add to Info.plist an explanation of why the app needs the camera:
<key>NSCameraUsageDescription</key>
<string>We use the camera to photograph your ID document and take a selfie for identity verification.</string>Without this line the app is terminated
iOS ends the app at the first camera request if the description is missing.
The verification does not need the microphone, and the SDK does not ask for it.
UIKit
import VeriffySDK
func startVerification() async throws {
let url = try await backend.createVerificationSession() // your server: POST /v1/sessions
Veriffy.start(from: self, url: url) { result in
switch result {
case .completed(let status):
self.showPending(status) // .approved, .review, .processing …
case .cancelled:
self.showRetry()
case .failed(let error) where error.code == .expired:
self.restartWithNewSession()
case .failed(let error):
self.show(error) // .cameraDenied, .network, .invalidLink …
}
}
}To follow the progress, pass onEvent:
Veriffy.start(from: self, url: url, onEvent: { event in
if case let .step(name, index, total) = event.kind {
print("step \(name): \(index) of \(total)")
}
}) { result in /* … */ }SwiftUI
@State private var kycURL: URL?
var body: some View {
Button("Verify my identity") { Task { kycURL = try? await backend.createVerificationSession() } }
.veriffy(url: $kycURL) { result in
// .completed, .cancelled or .failed
}
}What the SDK does for you
- Asks for camera access before the page loads. On iOS 15 and later the user sees one system prompt only: the second one, from WebKit, the SDK answers itself, and only for the verification address.
- If access is denied, shows a screen with a button to open Settings.
- Keeps no WebView data between verifications.
- Opens external links in the system browser; navigation to other addresses inside the verification is blocked.