Teydex iOS Document
This document contains all the steps, usage examples, and platform-specific technical details required to integrate the Teydex library securely and smoothly on the iOS platform.
Version Requirements
To use the Teydex iOS library without issues, you need to verify your versions.
| Platform | Min version |
|---|---|
| iOS | iOS 15.0 |
| Swift 5.5 | |
| Xcode 26.1 |
iOS Swift Package Manager Configuration
Add the KYCFramework package to your project via Swift Package Manager. The library will automatically download all required dependencies for you.
Background Modes Settings
In the Signing & Capabilities tab, make sure the following options are enabled under Background Modes:
- Audio, AirPlay, and Picture in Picture
- Voice over IP
- Background fetch
Info.plist Permissions
You need to add the following descriptions to your application's Info.plist file. These messages will be shown to users when permission is requested:
<key>NSCameraUsageDescription</key>
<string>Grant access so others can see you during video calls</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Grant access so your location can be verified</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Grant access so your location can be verified</string>
<key>NSMicrophoneUsageDescription</key>
<string>Grant access so others can hear you during video calls</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Grant access so your photos can be saved to your photo library</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Grant access so your photo library can be browsed</string>
<key>NSLocationTemporaryUsageDescriptionDictionary</key>
<dict>
<key>FullAccuracy</key>
<string>Grant access so your location can be verified</string>
</dict>
Info Screen
The Info screen in your KYC application refers to the information pages displayed before the steps. Optionally, the following parameters can be added for each step.
Info Screen Properties
| Parameter | Type | Description |
|---|---|---|
| setTitleText | String | Specifies the title to be displayed on the Info screen. |
| setDescriptionText | String | Specifies the description text to be displayed on the Info screen. |
| setButtonText | String | Specifies the text of the button that starts the step on the Info screen. |
| setAssetImageName | String | Specifies the image to be displayed on the Info screen. |
| setLottieFileName | String | Specifies the Lottie animation to be displayed on the Info screen. |
| setBullets | [String] | Can be used when you want to provide bullet-point information about the next step. |
| bulletIconName | @RawRes Int | Can be used to change the icon of the bullet items displayed on the Info screen. |
| setCancelButtonIsActive | Bool | Enables or disables the cancel button shown in the top-right corner of the Info screen. It is disabled by default. |
Info Screen Usage
let frontInfo = infoTemplate
.setTitleText("Front Side of ID")
.setDescriptionText("Please follow the steps below carefully:")
.setButtonText("Continue")
.setLottieFileName("front")
.setBullets([
"Place Your ID\n" +
"Hold the back side of your ID parallel to the phone screen. The ID must be positioned so that it fits completely within the template shown on the screen.",
"Visibility of ID Information\n Make sure all information on the ID is clearly visible. The ID details should not be blurry and should be easy to read."
])
.build()
Step
The properties to be used in all steps are defined in this area. These properties are available in every step (Front, Back, Hologram, NFC, Liveness, VideoCall).
Step Properties
| Parameter | Type | Description |
|---|---|---|
| setInfoView | Info | Used to add an Info screen to the related step. Optional. |
| setTitle | String | Represents the toolbar text displayed in the related step. |
| setStepType | StepType | Specifies the type of the step (.idcardFront, .idcardBack, etc.). |
Front Step Usage
let idFrontStep = stepTemplate
.setTitle("Front Side of ID")
.setInfoView(frontInfo)
.setStepType(.idcardFront)
.build()
Back Step Usage
let idBackStep = stepTemplate
.setTitle("Back Side of ID")
.setInfoView(backInfo)
.setStepType(.idcardBack)
.build()
NFC Step Usage
let nfcStep = stepTemplate
.setTitle("NFC")
.setInfoView(nfcInfo)
.setStepType(.nfc)
.build()
Hologram Step Usage
let hologramStep = stepTemplate
.setTitle("Hologram")
.setInfoView(hologramInfo)
.setStepType(.hologram)
.build()
Liveness Step Usage
let faceStep = stepTemplate
.setTitle("Face Verification")
.setInfoView(livenessInfo)
.setStepType(.face)
.build()
VideoCall Step Usage
let videoCall = stepTemplate
.setTitle("Video Call")
.setInfoView(videoCallInfo)
.setStepType(.videoCall)
.build()
LivenessConfig
Used to customize the instructions that will be used in the liveness step.
LivenessConfig Properties
| Parameter | Type | Description |
|---|---|---|
| dotRadius | CGFloat? | Specifies the radius of the dots displayed on the screen during the liveness check. |
| dotColor | UIColor? | Defines the default color of the dots used for liveness indicators. |
| activeDotColor | UIColor? | Sets the color of the currently active dot during the liveness check. |
| titleText | String? | The main title text displayed during the liveness check. |
| upText | String? | The instruction text shown when the user needs to move their head upward. |
| downText | String? | The instruction text shown when the user needs to move their head downward. |
| leftText | String? | The instruction text shown when the user needs to turn their head to the left. |
| rightText | String? | The instruction text shown when the user needs to turn their head to the right. |
| centerYourFaceText | String? | The instruction text asking the user to center their face within the frame. |
| faceNotDetectedText | String? | The message shown when the user's face cannot be detected during the liveness check. |
LivenessConfig Usage
let livenessConfig = LivenessConfig(
dotRadius: 10.0,
dotColor: .gray,
activeDotColor: .green,
titleText: "Face Verification",
upText: "Please raise your head",
downText: "Please lower your head",
leftText: "Please turn your head to the left",
rightText: "Please turn your head to the right",
centerYourFaceText: "Please center your face",
faceNotDetectedText: "Face could not be detected"
)
UIConfig
Used to define the general visual properties that will be used in Info screens and bottom sheets.
UIConfig Properties
| Parameter | Type | Description |
|---|---|---|
| buttonColor | UIColor? | Specifies the background color of buttons displayed on Info screens and bottom sheets. |
| buttonTextColor | UIColor? | Sets the text color of buttons displayed on Info screens and bottom sheets. |
| bulletTextColor | UIColor? | Defines the color of bullet-point text on Info screens and bottom sheets. |
| buttonCornerRadius | Int? | Specifies the corner radius of buttons for styling purposes. |
| bulletIconName | String? | Specifies the name of the icon used for bullet points on Info screens and bottom sheets. |
UIConfig Usage
let uiConfig = UIConfig(
buttonColor: UIColor(named: "purple_700"),
buttonTextColor: .white,
bulletTextColor: UIColor(named: "teal_700"),
buttonCornerRadius: 30,
bulletIconName: "bullet_icon"
)
KYCManagerConfig
Used to configure general UI information and error messages.
KYCManagerConfig Properties
| Parameter | Type | Description |
|---|---|---|
| showCompletedScreen | Bool | Controls whether the screen shown when the process is completed successfully is enabled or disabled. It is false by default. |
| cameraErrorMessage | [String] | Allows customization of messages used for camera errors. |
| nfcErrorMessage | [String] | Allows customization of messages used for NFC errors. |
| videoCallErrorMessage | [String] | Allows customization of messages used for video call errors. |
| timeOutErrorMessage | [String] | Allows customization of messages used for timeout errors. |
| serverErrorMessage | [String] | Allows customization of messages used for server errors. |
| rejectedErrorMessage | [String] | Allows customization of messages used for rejection errors. |
| identityReadFailedError | [String] | Allows customization of messages used for identity read errors. |
| videoCallSplashScreenAssetName | String | Used to customize the full-screen image displayed when the video call screen is opened. |
| closeIconAssetName | String | Used to customize the image used for the close button on Info screens. |
| livenessConfig | LivenessConfig | Used to customize the instructions in the liveness step. |
| uiConfig | UIConfig? | Used to customize the instructions in the Info screen and bottom sheet. |
KYCManagerConfig Usage
let configuration = KYCManagerConfigBuilder()
.setCameraErrorMessage([.cameraPermissionDenied: "Camera permission denied"])
.setNFCErrorMessage([.deviceNotHaveNFC: "Your device does not have NFC"])
.setShowCompletedScreen(true)
.setVideoCallSplashScreenAssetName("splash_background")
.setCloseIconAssetName("close_icon")
.setLivenessConfig(livenessConfig)
.setUIConfig(uiConfig)
.build()
KYCManagerDelegate
The delegate protocol used to manage events and errors in the KYC process.
import KYCFramework
class ViewController: UIViewController, KYCManagerDelegate {
func onCompletion(_ isSuccess: Bool) {
// You can listen to whether the identity verification step was successful through this function.
if isSuccess {
print("KYC process completed successfully")
} else {
print("KYC process failed")
}
}
// The onEvent and onError functions allow you to handle which steps were opened,
// which operations were performed, and the error cases that occurred during the identity verification process.
// These functions provide the information required for logging to platforms such as Countly and Firebase.
func onEvent(_ event: KYCFramework.LogState) {
print("KYC Event: \(event)")
}
func onError(_ error: KYCFramework.KYCError) {
print("KYC Error: \(error)")
}
override func viewDidLoad() {
super.viewDidLoad()
KYCManager.shared.delegate = self
}
}
Starting KYC
Start Function
func startKYC(token: String) {
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
KYCManager.shared.enterKYC(
from: self.navigationController!,
clientToken: token,
applicationId: applicationId,
stepList: KYCConfig.getStepList(),
configuration: KYCConfig.getManagerConfig()
)
}
}
Full Configuration Example
class KYCConfig {
// Info template
static let infoTemplate = InfoBuilder()
// Front Info
static let frontInfo = infoTemplate
.setTitleText("Front Side of ID")
.setDescriptionText("We will scan the front side of your ID")
.setButtonText("Start")
.setLottieFileName("id_front_animation")
.setBullets([
"Place your ID on a flat surface",
"Make sure the ID details are clearly visible"
])
.build()
// Back Info
static let backInfo = infoTemplate
.setTitleText("Back Side of ID")
.setDescriptionText("We will scan the back side of your ID")
.setButtonText("Continue")
.setLottieFileName("id_back_animation")
.setBullets([
"Turn your ID over",
"Make sure the MRZ code is clearly visible"
])
.build()
// Step template
static let stepTemplate = StepBuilder()
// Steps
static let idFrontStep = stepTemplate
.setTitle("Front Side of ID")
.setInfoView(frontInfo)
.setStepType(.idcardFront)
.build()
static let idBackStep = stepTemplate
.setTitle("Back Side of ID")
.setInfoView(backInfo)
.setStepType(.idcardBack)
.build()
static let hologramStep = stepTemplate
.setTitle("Hologram")
.setInfoView(hologramInfo)
.setStepType(.hologram)
.build()
static let nfcStep = stepTemplate
.setTitle("NFC")
.setInfoView(nfcInfo)
.setStepType(.nfc)
.build()
static let faceStep = stepTemplate
.setTitle("Face Verification")
.setInfoView(livenessInfo)
.setStepType(.face)
.build()
static let videoCall = stepTemplate
.setTitle("Video Call")
.setInfoView(videoCallInfo)
.setStepType(.videoCall)
.build()
// Configuration
static let configuration = KYCManagerConfigBuilder()
.setCameraErrorMessage([
.cameraPermissionDenied: "Camera permission was not granted. Please enable camera permission in settings.",
.cameraSourceNotFound: "Camera not found."
])
.setNFCErrorMessage([
.deviceNotHaveNFC: "Your device does not support NFC.",
.notEnable: "NFC is turned off. Please enable NFC in settings."
])
.setShowCompletedScreen(true)
.build()
// Helper functions
static func getStepList() -> [Step] {
return [idFrontStep, idBackStep, hologramStep, nfcStep, faceStep, videoCall]
}
static func getManagerConfig() -> KYCManagerConfig {
return configuration
}
}
Error Handling
The types and descriptions of errors that may come from the SDK are listed below. These error messages can be customized inside KYCManagerConfig.
Camera Errors
cameraPermissionDenied: Camera permission deniedcameraSourceNotFound: Camera not foundflashMode: Flash on/off error
NFC Errors
deviceNotHaveNFC: Device does not have NFCnotEnable: NFC is not enabledtagNotSupported: ID card is not supportedtagLost: Lost during ID reading
Video Call Errors
connectionFailed: Connection errormicrophonePermissionDenied: Microphone permission denied
Other Errors
timeout: Timeout errorserverError: Server errorrejected: Process rejectedidentityReadFailed: Identity could not be read