K
K
Kvalifika
Search…
iOS
Guide for integrating Kvalifika SDK into a Swift project
Use Kvalifika SDK to easily integrate into your Android app. Before integrating Kvalifika, it is recommended to follow the steps described in Integration Guide and Initial Setup.
Naming of the properties and functions might be slightly modified depending on the version.

Installation

Add the following to the project's main Podfile file:
1
source 'https://github.com/CocoaPods/Specs.git'
2
source 'https://github.com/Kvalifika/kvalifika-cocoapods-specs.git'
3
source 'https://github.com/Kvalifika/zoom-cocoapods-specs.git'
4
5
platform :ios, '11.0'
6
7
# Your Target
8
target 'kvalifika-swift-sample' do
9
use_frameworks!
10
11
pod 'Kvalifika'
12
end
Copied!
If you want to update pod run in terminal:
pod update Kvalifika

Initialize the SDK

import Kvalifika
After that, you need to initialize SDK with your appId.
appId is Application ID, generated from Admin Panel. See Initial Setup for details.
1
class ViewController: UIViewController {
2
override func viewDidLoad() {
3
super.viewDidLoad()
4
5
// Initialize SDK and provide names of images
6
KvalifikaSDK.initialize(
7
AppID: "YOUR APP ID",
8
Locale: KvalifikaSDKLocale.GE.rawValue,
9
Logo: "AppLogo",
10
DocumentIcon: "DocLogo",
11
CancelIcon: "cancel",
12
ActiveFlashIcon: "",
13
InactiveFlashIcon: "",
14
onInitialize: onInitialize,
15
onStart: onStart,
16
onFinish: onFinish,
17
onError: onError
18
)
19
}
20
21
func onInitialize() {
22
// Start session right after initialization
23
let _ = KvalifikaSDK.startSession(onViewController: self)
24
}
25
26
func onStart(sessionId: String) {
27
print("onStart")
28
}
29
30
func onFinish(sessionId: String) {
31
print("onFinish")
32
}
33
34
func onError(error: KvalifikaSDKError) {
35
print(error)
36
}
37
}
Copied!

App Permissions

Please add the following permissions to your app's Info.plist, so that the Kvalifika iOS SDK can access a user's camera to run a verification. You can do this in the property list view or by code. Right-click on Info.plist and select Open As -> Source Code. Add the lines below somewhere inside the file <dict> </dict>
1
<!-- permission strings to be include in info.plist -->
2
<key>NSCameraUsageDescription</key>
3
<string>Please give us access to your camera, to complete the verification.</string>
4
<key>NSPhotoLibraryUsageDescription</key>
5
<string>Please give us access to your photo library to verify you.</string>
Copied!

Start Verification

Call Kvalifika.startSession() on button click event
1
class ViewController: UIViewController {
2
override func viewDidLoad() {
3
super.viewDidLoad()
4
5
// Initialize SDK
6
KvalifikaSDK.initialize(
7
AppID: "YOUR APP ID",
8
Locale: KvalifikaSDKLocale.GE.rawValue,
9
Logo: "AppLogo",
10
DocumentIcon: "DocLogo",
11
CancelIcon: "cancel",
12
ActiveFlashIcon: "",
13
InactiveFlashIcon: "",
14
onInitialize: onInitialize,
15
onStart: onStart,
16
onFinish: onFinish,
17
onError: onError
18
)
19
}
20
21
func onInitialize() {
22
print("onInitialize")
23
}
24
25
func onStart(sessionId: String) {
26
print("onStart")
27
}
28
29
func onFinish(sessionId: String) {
30
print("onFinish")
31
}
32
33
func onError(error: KvalifikaSDKError) {
34
print(error)
35
}
36
37
@IBAction func onStart(_ sender: Any) {
38
let _ = KvalifikaSDK.startSession(onViewController: self)
39
}
40
}
Copied!

Handling Verifications

It's useful to know that whether a user has completed the verification flow or canceled it. For this, you can implement the callback methods.

Callback Methods

Method
Description
onInitialize
This callback method is triggered when SDK is initialized.
onStart
This callback method is triggered when the user starts verification.
onFinish
This callback method is triggered when the user completes verification. Get session data here.
onError
This callback method is triggered on error (see Error Codes for more information)
1
func onInitialize() {
2
print("onInitialize")
3
// Start session right after initialization
4
let _ = KvalifikaSDK.startSession(onViewController: self)
5
}
6
7
func onStart(sessionId: String) {
8
print("onStart")
9
}
10
11
func onFinish(sessionId: String) {
12
// Fetch session data here from your server
13
print("onFinish")
14
}
15
16
func onError(error: KvalifikaSDKError) {
17
print(error)
18
}
Copied!

Error Codes

Error Code
Description
INVALID_APP_ID
Kvalifika App Id is incorrect
USER_CANCELLED
User canceled before completing verification.
TIMEOUT
Canceled due to inactivity.
SESSION_UNSUCCESSFUL
The Session was not performed successfully
ID_UNSUCCESSFUL
The ID Scan was not performed successfully and identity document data was not generated.
CAMERA_PERMISSION_DENIED
Camera is required but access is prevented by user settings.
LANDSCAPE_MODE_NOT_ALLOWED
Verification was canceled because the device is in landscape mode.
REVERSE_PORTRAIT_NOT_ALLOWED
Verification was canceled because the device is in reverse portrait mode.
FACE_IMAGES_UPLOAD_FAILED
Could not upload face images. Internal request failed.
DOCUMENT_IMAGES_UPLOAD_FAILED
Could not upload ID card or passport images. Internal request failed.
NO_MORE_ATTEMPTS
User has reached maximum limit of attempts
UNKNOWN_INTERNAL_ERROR
Session failed because of an unhandled internal error.

UI Customizations

Appearance

It is possible to customize the logo and icons and provide resource names.
1
KvalifikaSDK.initialize(
2
Logo: "AppLogo",
3
DocumentIcon: "DocLogo",
4
CancelIcon: "cancel",
5
ActiveFlashIcon: "",
6
InactiveFlashIcon: "",
7
)
Copied!

Language

It is possible to set locale when initializing SDK. Supported locales are:
Code
Language
EN
English
GE
Georgian
RU
Russian
SP
Spanish
1
sdk = KvalifikaSDK.initialize(
2
Locale: KvalifikaSDKLocale.EN.rawValue
3
)
Copied!

Development Mode

Without specifying mode SDK uses https://api.kvalifika.com
With development mode ON SDK uses https://apistaging.kvalifika.com
1
KvalifikaSDK.initialize(
2
AppID: "YOUR APP ID"
3
Development: true
4
)
Copied!
Last modified 4mo ago