iOS SDK

Integrate biometric verification and identity scanning into your iOS app
View as Markdown

The VLens iOS SDK embeds the full identity verification experience — national ID scanning, liveness detection, and face matching — directly into your iOS app. It supports both SwiftUI and UIKit and uses ARKit face tracking for liveness.

GitHub

vlens-ios-sdk · v1.4.4

iOS

iOS 15.0+, Swift 5.5+

Xcode

Xcode 13.0+, TrueDepth camera required

Liveness detection requires a TrueDepth camera (iPhone X and later, excluding SE models). Devices without TrueDepth will fail unless allowNonTrueDepthFallback is enabled, in which case auto-capture fires every 2 seconds as a fallback.


Installation

  1. In Xcode, go to File → Add Package Dependencies…
  2. Enter the repository URL: https://github.com/Vlens2021/vlens-ios-sdk
  3. Select version 1.4.4 (or latest) and click Add Package

Required permissions

Add the following key to your Info.plist:

1<key>NSCameraUsageDescription</key>
2<string>Camera is required for identity verification</string>

Quick start — SwiftUI

1import SwiftUI
2import VLensLib
3
4struct ContentView: View {
5 @State private var showVLens = false
6 @State private var accessToken = ""
7
8 var body: some View {
9 Button("Start Verification") {
10 showVLens = true
11 }
12 .vlensVerification(
13 isPresented: $showVLens,
14 transactionId: UUID().uuidString,
15 apiKey: "YOUR_API_KEY",
16 secretKey: "",
17 tenancyName: "YOUR_TENANCY_NAME",
18 accessToken: accessToken,
19 onSuccess: { txnId, userData in
20 print("Verified: \(userData?.user?.fullName ?? "")")
21 },
22 onFailure: { txnId, error in
23 print("Error: \(error)")
24 }
25 )
26 }
27}

Quick start — UIKit

1import UIKit
2import VLensLib
3
4class VerificationViewController: UIViewController, VLensDelegate {
5 private var vlensManager: VLensManager!
6
7 func startVerification(accessToken: String) {
8 vlensManager = VLensManager(
9 transactionId: UUID().uuidString,
10 apiKey: "YOUR_API_KEY",
11 secretKey: "",
12 tenancyName: "YOUR_TENANCY_NAME",
13 language: "en"
14 )
15 vlensManager.setAccessToken(accessToken)
16 vlensManager.delegate = self
17 vlensManager.present(on: self, withLivenessOnly: false)
18 }
19
20 func didValidateSuccessfully(transactionId: String,
21 userData: VerifyIdBackPost.DataClass?) {
22 print("Success: \(transactionId)")
23 print("Name: \(userData?.user?.fullName ?? "N/A")")
24 }
25
26 func didFailToValidate(transactionId: String, error: String) {
27 print("Failed: \(error)")
28 }
29}

Configuration parameters

ParameterTypeRequiredDefaultDescription
transactionIdStringYesUnique identifier for the transaction
apiKeyStringYesYour tenant API key
secretKeyStringYes""Secret key — pass empty string when using token auth
tenancyNameStringYesYour tenant name
accessTokenStringYesBearer token from the Login API
languageStringNo"en"UI language — "en" or "ar"
withLivenessOnlyBoolNofalseSkip ID capture — liveness check only
noOfRetriesIntNo5Liveness retry attempts before failure
allowAutoCaptureBoolNotrueEnable automatic document scanning
allowNonTrueDepthFallbackBoolNofalseAllow operation on non-TrueDepth devices
showCloseButtonBoolNoShow a close/dismiss button
colorsVLensColorsNodefaultCustom colour theme
onDismiss() -> VoidNonilCalled when the close button is tapped

Verification modes

Runs the complete flow: ID front → ID back → liveness.

1.vlensVerification(
2 isPresented: $showVLens,
3 transactionId: transactionId,
4 apiKey: "YOUR_API_KEY",
5 secretKey: "",
6 tenancyName: "YOUR_TENANCY_NAME",
7 accessToken: accessToken,
8 onSuccess: { txnId, userData in },
9 onFailure: { txnId, error in }
10)

Custom branding

1let customColors = VLensColors(
2 light: VLensColorConfig(
3 accent: "#007AFF",
4 primary: "#1E3A5F",
5 secondary: "#666666",
6 background: "#FFFFFF",
7 dark: "#1C1C1E",
8 light: "#F2F2F7"
9 ),
10 dark: VLensColorConfig(
11 accent: "#0A84FF",
12 primary: "#FFFFFF",
13 secondary: "#ABABAB",
14 background: "#1C1C1E",
15 dark: "#000000",
16 light: "#2C2C2E"
17 )
18)

Pass customColors to the colors parameter of your VLensColors config.


Obtaining an access token

Call the Login API before launching the SDK:

POST https://api.vlenseg.com/api/DigitalIdentity/Login

Headers:

Content-Type: application/json
ApiKey: YOUR_API_KEY
TenancyName: YOUR_TENANT

Body:

1{
2 "geoLocation": { "latitude": "30", "longitude": "30" },
3 "imei": "device_identifier",
4 "phoneNumber": "+20XXXXXXXXXX",
5 "password": "your_password",
6 "smsProviders": 0
7}

Extract data.accessToken from the response and pass it to the SDK.


What’s new in v1.4.4

  • GIF background tinting applies accent colour across all start and loading screens
  • Icon backgrounds tinted consistently behind ID and face vector images
  • loadingTitleLabel outlets wired in NationalIdBack and ValidationMain screens

See all releases on GitHub.


Support

For issues or inquiries, contact support@vlenseg.com with your tenant name, the error message, and the SDK version.