Our SDK allows a user of your app to scan or take a photo of their document and/or face, we then verify this instantly and prepare a response that your system can retrieve on your hosted site.
To integrate with our SDK, a working infrastructure is needed - see developers.yoti.com for more details.
iOS 14+
Add the following line to your Package.swift
file:
.package(url: "https://github.com/getyoti/yoti-doc-scan-ios.git", from: "7.0.0")
...or add our package in Xcode via File -> Swift Packages -> Add Package Dependency...
using the URL of this repository.
If you include YotiSDKIdentityDocument
in your target, then consider to also include YotiDocumentScan
and/or YotiNFC
for identity document OCR and NFC. If you include YotiNFC
, make sure to weak-link your binary to CoreNFC
as well.
Add the following to your Podfile
and run pod install
from its directory:
platform :ios, '14.0'
target 'TargetName' do
use_frameworks!
pod 'YotiDocumentScan' // Include if `YotiSDKIdentityDocument` is included and to support identity document OCR
pod 'YotiNFC' // Include if `YotiSDKIdentityDocument` is included and to support identity document NFC
pod 'YotiSDKIdentityDocument' // Optional
pod 'YotiSDKSupplementaryDocument' // Optional
pod 'YotiSDKFaceTec' // Optional
pod 'YotiSDKFaceCapture' // Optional
end
Add the following to your Cartfile
and run carthage bootstrap --platform iOS --use-xcframeworks
from its directory:
binary "https://raw.githubusercontent.com/getyoti/yoti-doc-scan-ios/master/Specs/Carthage/YotiNetwork.json"
binary "https://raw.githubusercontent.com/getyoti/yoti-doc-scan-ios/master/Specs/Carthage/YotiDocumentScan.json" // Include if `YotiSDKIdentityDocument` is included and to support identity document OCR
binary "https://raw.githubusercontent.com/getyoti/yoti-doc-scan-ios/master/Specs/Carthage/YotiNFC.json" // Include if `YotiSDKIdentityDocument` is included and to support identity document NFC
binary "https://raw.githubusercontent.com/getyoti/yoti-doc-scan-ios/master/Specs/Carthage/YotiSDKDesign.json"
binary "https://raw.githubusercontent.com/getyoti/yoti-doc-scan-ios/master/Specs/Carthage/YotiSDKCore.json"
binary "https://raw.githubusercontent.com/getyoti/yoti-doc-scan-ios/master/Specs/Carthage/YotiSDKDocument.json" // Include if `YotiSDKIdentityDocument` or `YotiSDKSupplementaryDocument` is included
binary "https://raw.githubusercontent.com/getyoti/yoti-doc-scan-ios/master/Specs/Carthage/YotiSDKIdentityDocument.json" // Optional
binary "https://raw.githubusercontent.com/getyoti/yoti-doc-scan-ios/master/Specs/Carthage/YotiSDKSupplementaryDocument.json" // Optional
binary "https://raw.githubusercontent.com/getyoti/yoti-doc-scan-ios/master/Specs/Carthage/YotiSDKFace.json" // Include if `YotiSDKFaceTec` or `YotiSDKFaceCapture` is included
binary "https://raw.githubusercontent.com/getyoti/yoti-doc-scan-ios/master/Specs/Carthage/YotiSDKFaceTec.json" // Optional
binary "https://raw.githubusercontent.com/getyoti/yoti-doc-scan-ios/master/Specs/Carthage/YotiSDKFaceCapture.json" // Optional
Locate your fetched dependencies in $(PROJECT_DIR)/Carthage/Build/**
, and add them to General
→ Frameworks, Libraries and Embedded Content
. Make sure to Embed & Sign
these dependencies and to point your target's FRAMEWORK_SEARCH_PATHS
to their directory.
You should also ensure that your binary and dependencies are linked in Build Phases
→ Link Binary With Libraries
. If you've embedded YotiNFC
in your target, then make sure to weak-link your binary to CoreNFC
as well.
Import the frameworks needed for your implementation:
import YotiSDKCore
import YotiSDKIdentityDocument // Optional
import YotiSDKSupplementaryDocument // Optional
import YotiSDKFaceTec // Optional
import YotiSDKFaceCapture // Optional
Initialize and present YotiSDKNavigationController
:
let navigationController = YotiSDKNavigationController()
navigationController.sdkDataSource = self
navigationController.sdkDelegate = self
present(navigationController, animated: true, completion: nil)
Conform to YotiSDKDataSource
:
func configuration() -> YotiSDKConfiguration {
.init(
sessionID: "",
sessionToken: "",
// If `singleFlow` is true, `moduleTypes` must contain exactly one module type.
// If `singleFlow` is false, `moduleTypes` must contain at least one module type.
singleFlow: false,
moduleTypes: [
YotiSDKIdentityDocumentModule.self, // Optional
YotiSDKSupplementaryDocumentModule.self, // Optional
YotiSDKFaceTecModule.self, // Optional
YotiSDKFaceCaptureModule.self // Optional
],
// If `theme` is nil, our default theme is used.
// `YotiSDKThemeBuilder` can be used to build a custom theme, in which we support:
// - Light and dark mode color themes. We also support specifying only a primary color for each mode
// - Typography theme (system and custom fonts, font weight, size, line height multiple and kern)
// - Spacing mode (compact, regular and relaxed)
// - Shape theme (corner radius and border width)
// - Icon theme (custom vectors, system and custom SF Symbols, incl. localized ones)
// - Illustration theme (custom vectors)
theme: YotiSDKThemeBuilder {
// All customisation types are optional, and each one can be set independently from the others.
$0.spacingMode = .compact
...
}.build()
)
}
Conform to YotiSDKDelegate
:
func didFinish(statusCode: Int) {
dismiss(animated: true)
print(statusCode)
}
Add NSCameraUsageDescription
to your Info.plist
.
If YotiNFC
is included in your target, then you should also:
- Add
NFCReaderUsageDescription
to yourInfo.plist
- Add
com.apple.developer.nfc.readersession.iso7816.select-identifiers
to yourInfo.plist
and includeA0000002471001
as an application identifier for your app to support - Turn on
Near Field Communication Tag Reading
under the Signing & Capabilities tab for your project’s target
Our SDK supports the 9 languages listed in the table below, but their use is driven by the localization configuration of your target. If your target only supports a subset of our SDK's supported languages, our SDK will fall back to English on the ones your target doesn't support.
Language | Code |
---|---|
Arabic | ar |
Dutch | nl |
English (default) | en |
French | fr |
German | de |
Italian | it |
Russian | ru |
Spanish | es |
Turkish | tr |
Code | Description |
---|---|
0 | The user completed the session |
1000 | The user cancelled the session |
2000 | Unauthorised request (wrong or expired session token) |
2001 | Session not found |
2002 | Session expired |
2003 | SDK launched without a session token |
2004 | SDK launched without a session id |
3000 | Yoti's services are down or unable to process the request |
3001 | An error occurred during a network request |
3002 | The user did not have a network connection |
3003 | A network request timed out |
4000 | The user did not grant permission to the camera |
4001 | The user submitted a wrong document |
5000 | The user's camera was not found and file upload is not allowed |
5002 | No more local tries for the liveness flow |
5003 | SDK is out-of-date, please update the SDK to the latest version |
5004 | An unexpected internal error occurred |
5005 | An unexpected document capture error occurred |
5006 | An unexpected liveness capture error occurred |
5008 | An unsupported configuration was used |
6000 | The identity document dependency could not be found |
6001 | The face scan dependency could not be found |
6002 | The supplementary document dependency could not be found |
6003 | The face capture dependency could not be found |
7000 | The user did not have the required documents |
For any questions or support please contact us here. Once we have answered your question, we may contact you again to discuss Yoti products and services. If you'd prefer us not to do this, please let us know when you e-mail.
See the licence here.