Teydex iOS Document
This document contains all the necessary steps, usage examples, and platform-specific technical details for securely and seamlessly integrating the Teydex library on the iOS platform.
Version Requirements
You need to check your versions to use the Teydex iOS library seamlessly.
| Platform | Min version |
|---|---|
| iOS | iOS 13.0 |
| Swift 5.5 | |
| Xcode 16.2 |
iOS Swift Package Manager Configuration
Add the KYCFramework package to your project via Swift Package Manager. The library will automatically download all necessary dependencies for you.
Background Modes Settings
In the Signing & Capabilities tab, make sure the following options are checked 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 requesting permissions:
<key>NSCameraUsageDescription</key>
<string>Video görüşmeleri sırasında diğerlerinin sizi görebilmesi için erişim verin</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Konumunuzun doğrulanabilmesi için erişim verin</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Konumunuzun doğrulanabilmesi için erişim verin</string>
<key>NSMicrophoneUsageDescription</key>
<string>Video görüşmeleri sırasında diğerlerinin sizi duyabilmesi için erişim verin</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Fotoğraflarınızı fotoğraf galerinize kaydedebilmek için erişim verin</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Fotoğraf galerinize göz atabilmek için erişim verin</string>
<key>NSLocationTemporaryUsageDescriptionDictionary</key>
<dict>
<key>FullAccuracy</key>
<string>Konumunuzun doğrulanabilmesi için erişim verin</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 information 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 will start the step shown on the Info screen. |
| setAssetImageName | String | Specifies the image to be shown on the Info screen. |
| setLottieFileName | String | Specifies the lottie animation to be shown on the Info screen. |
| setBullets | [String] | Can be used when you want to provide bullet-point information about the next step on the Info screen. |
| bulletIconName | @RawRes Int | Can be used to change the icon of the bullet items shown on the Info screen. |
| setCancelButtonIsActive | Bool | Enables or disables the display of the cancel button in the top right corner of the Info screen. Disabled by default. |
Info Screen Usage
let frontInfo = infoTemplate
.setTitleText("Kimlik Ön Yüz")
.setDescriptionText("Lütfen aşağıdaki adımları dikkatlice takip ediniz:")
.setButtonText("Devam")
.setLottieFileName("front")
.setBullets([
"Kimliğinizi Yerleştirin\n" +
"Kimliğinizin arka yüzünü, telefon ekranına paralel bir şekilde tutun. Kimlik, ekranda görünen şablonun içine tam olarak yerleşecek şekilde konumlandırılmalıdır.",
"Kimlik Bilgilerinin Görünürlüğü\n Kimlik üzerindeki tüm bilgilerin net bir şekilde göründüğünden emin olun. Kimlik bilgileri bulanık olmamalı ve kolayca okunabilir olmalıdır"
])
.build()
Step
The properties to be used in all steps are specified in this field. 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 to be displayed in the related step. |
| setStepType | StepType | Specifies the type of the step (.idcardFront, .idcardBack, etc.) |
Front Step Usage
let idFrontStep = stepTemplate
.setTitle("Kimlik Ön Yüz")
.setInfoView(frontInfo)
.setStepType(.idcardFront)
.build()
Back Step Usage
let idBackStep = stepTemplate
.setTitle("Kimlik Arka Yüz")
.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("Yüz Doğrulama")
.setInfoView(livenessInfo)
.setStepType(.face)
.build()
VideoCall Step Usage
let videoCall = stepTemplate
.setTitle("Video Görüşme")
.setInfoView(videoCallInfo)
.setStepType(.videoCall)
.build()
LivenessConfig
Used to customize the instructions to be used in the liveness step.
LivenessConfig Properties
| Parameter | Type | Description |
|---|---|---|
| dotRadius | CGFloat? | Specifies the radius of the dots displayed on the screen during liveness control. |
| dotColor | UIColor? | Defines the default color of the dots used for liveness indicators. |
| activeDotColor | UIColor? | Sets the color of the active dot during liveness control. |
| titleText | String? | The main title text displayed during liveness control. |
| upText | String? | The instruction text displayed when the user needs to move their head up. |
| downText | String? | The instruction text displayed when the user needs to move their head down. |
| leftText | String? | The instruction text displayed when the user needs to turn their head left. |
| rightText | String? | The instruction text displayed when the user needs to turn their head right. |
| centerYourFaceText | String? | The instruction text requesting the user to center their face in the frame. |
| faceNotDetectedText | String? | The message displayed when the user's face is not detected during liveness control. |
LivenessConfig Usage
let livenessConfig = LivenessConfig(
dotRadius: 10.0,
dotColor: .gray,
activeDotColor: .green,
titleText: "Yüz Doğrulama",
upText: "Lütfen başınızı yukarı kaldırın",
downText: "Lütfen başınızı aşağı indirin",
leftText: "Lütfen başınızı sola çevirin",
rightText: "Lütfen başınızı sağa çevirin",
centerYourFaceText: "Lütfen yüzünüzü ortalayın",
faceNotDetectedText: "Yüz algılanamadı"
)
UIConfig
Used to determine the general design properties to be used in Info screens and bottom sheets.
UIConfig Properties
| Parameter | Type | Description |
|---|---|---|
| buttonColor | UIColor? | Specifies the background color of buttons displayed in Info screens and bottom sheets. |
| buttonTextColor | UIColor? | Sets the text color of buttons displayed in Info screens and bottom sheets. |
| bulletTextColor | UIColor? | Defines the color of bulleted texts in Info screens and bottom sheets. |
| buttonCornerRadius | Int? | Determines the corner radius of buttons for styling purposes. |
| bulletIconName | String? | Specifies the name of the icon used for bullet points in 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 set general UI information and error messages.
KYCManagerConfig Properties
| Parameter | Type | Description |
|---|---|---|
| showCompletedScreen | Bool | Controls the parameter of whether the screen to be shown when the process is successfully completed is active or disabled. Default is false. |
| 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 reading errors. |
| videoCallSplashScreenAssetName | String | Used to customize the full-screen image displayed when the video call screen opens. |
| 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: "Kamera izni reddedildi"])
.setNFCErrorMessage([.deviceNotHaveNFC: "Cihazınızda NFC bulunmuyor"])
.setShowCompletedScreen(true)
.setVideoCallSplashScreenAssetName("splash_background")
.setCloseIconAssetName("close_icon")
.setLivenessConfig(livenessConfig)
.setUIConfig(uiConfig)
.build()
KYCManagerDelegate
Delegate protocol used to manage events and errors in the KYC process.
import KYCFramework
class ViewController: UIViewController, KYCManagerDelegate {
func onCompletion(_ isSuccess: Bool) {
// Kimlik doğrulama adımının başarılı olup olmadığını bu fonksiyon aracılığıyla dinleyebilirsiniz.
if isSuccess {
print("KYC süreci başarıyla tamamlandı")
} else {
print("KYC süreci başarısız oldu")
}
}
// onEvent ve onError fonksiyonları, kimlik doğrulama sürecinde hangi adımların açıldığını,
// hangi işlemlerin gerçekleştirildiğini ve oluşan hata durumlarını ele almanıza olanak tanır.
// Bu fonksiyonlar, Countly ve Firebase gibi platformlara loglama için gerekli bilgileri sağlar.
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()
)
}
}
Complete Configuration Example
class KYCConfig {
// Info template
static let infoTemplate = InfoBuilder()
// Front Info
static let frontInfo = infoTemplate
.setTitleText("Kimlik Ön Yüz")
.setDescriptionText("Kimliğinizin ön yüzünü taratacağız")
.setButtonText("Başla")
.setLottieFileName("id_front_animation")
.setBullets([
"Kimliğinizi düz bir yüzeye yerleştirin",
"Kimlik bilgilerinin net görünür olduğundan emin olun"
])
.build()
// Back Info
static let backInfo = infoTemplate
.setTitleText("Kimlik Arka Yüz")
.setDescriptionText("Kimliğinizin arka yüzünü taratacağız")
.setButtonText("Devam Et")
.setLottieFileName("id_back_animation")
.setBullets([
"Kimliğinizi ters çevirin",
"MRZ kodunun net görünür olduğundan emin olun"
])
.build()
// Step template
static let stepTemplate = StepBuilder()
// Steps
static let idFrontStep = stepTemplate
.setTitle("Kimlik Ön Yüz")
.setInfoView(frontInfo)
.setStepType(.idcardFront)
.build()
static let idBackStep = stepTemplate
.setTitle("Kimlik Arka Yüz")
.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("Yüz Doğrulama")
.setInfoView(livenessInfo)
.setStepType(.face)
.build()
static let videoCall = stepTemplate
.setTitle("Video Görüşme")
.setInfoView(videoCallInfo)
.setStepType(.videoCall)
.build()
// Configuration
static let configuration = KYCManagerConfigBuilder()
.setCameraErrorMessage([
.cameraPermissionDenied: "Kamera izni verilmedi. Lütfen ayarlardan kamera iznini açın.",
.cameraSourceNotFound: "Kamera bulunamadı."
])
.setNFCErrorMessage([
.deviceNotHaveNFC: "Cihazınızda NFC özelliği bulunmuyor.",
.notEnable: "NFC kapalı. Lütfen ayarlardan NFC'yi açın."
])
.setShowCompletedScreen(true)
.build()
// Helper functions
static func getStepList() -> [Step] {
return [idFrontStep, idBackStep, hologramStep, nfcStep, faceStep, videoCall]
}
static func getManagerConfig() -> KYCManagerConfig {
return configuration
}
}
Error Management
The types and descriptions of errors that can come from the SDK are listed below. These error messages can be customized within KYCManagerConfig.
Camera Errors
cameraPermissionDenied: Camera permission deniedcameraSourceNotFound: Camera not foundflashMode: Flash on/off error
NFC Errors
deviceNotHaveNFC: Device does not have NFCnotEnable: NFC not enabledtagNotSupported: Identity card not supportedtagLost: Identity lost during reading
Video Call Errors
connectionFailed: Connection errormicrophonePermissionDenied: Microphone permission denied
Other Errors
timeout: Timeout errorserverError: Server errorrejected: Operation rejectedidentityReadFailed: Identity could not be read