Swiftpack.co - identance/ios-sdk as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by identance.
identance/ios-sdk 2.7.1
Identance iOS SDK
⭐️ 0
🕓 2 weeks ago
.package(url: "https://github.com/identance/ios-sdk.git", from: "2.7.1")

Identance iOS Integration


  • iOS 12.1+
  • Xcode 13.0+
  • Swift 5.5+
  • iPhone idiom only (using the SDK in App with Universal or iPad only idiom could lead to unpredicted behavior)
  • iPhone 5S+
  • Portrait and landscape orientation support on app level (see details below)



You must use at least 1.10 version of Cocoapods.

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Identance into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'Identance'

IMPORTANT: if you need to integrate Identance SDK into Objective-C code then you should use ZN prefix for Identance classes.

IMPORTANT: you shouldn't change original delpoyment version of Identance SDK and all its dependencies in Pod project. In other you case you could get compile or runtime errors.

Swift Package Manager (beta)

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. To integrate using Apple's Swift package manager from xcode :

  1. File -> Swift Packages -> Add Package Dependency...
  2. Enter package URL: https://github.com/identance/ios-sdk, always choose the latest release

Application Restrictions

To work properly SDK requires access to device Camera and Photo Library. For this purpose you must add (if not added there yet) next keys to your application Info.plist file:

  • NSPhotoLibraryUsageDescription - Description for Photo Library usage
  • NSCameraUsageDescription - Description for device Camera usage

Orientation Support

Identance SDK requires that host application must to support portait and landscape (left and right) orientation modes during verification process. It can be done by setting appropriate values to UISupportedInterfaceOrientations key inside Info.plist file or by proper implementing

optional func application(_ application: UIApplication, 
supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask

of UIApplicationDelegate.


Open IdentanceExample project with integrated SDK in Xcode. You need to execute the pod install command in the project dir to download the dependencies.

Start the verification process

Creating the Verification object

You access the main SDK features via the Verification object. To create it you need to first make the Configuration instance and setup its options:

Configuration options:
  • apiURL (required) - API endpoint to work with. Contact us to get one. Usually you need to use separate URLs for sandbox and production environments.
  • tokenProvider (required) - JWT Token provider instance. You need to implement the TokenProvider protocol to return the JWT Token string. You can use the existing class ClosureTokenProvider and setup the provider closure or make a new one. See Working with JsonWebToken for technical details.
  • workingMode (required) - use singleStage or allStages depending on your business logic.
  • localizationKeys (required) - LocalizationKeys instance with merchant related text localization keys. See details here: Texts
  • language (required) - SDK language:
    • system (default) - language of the host app. If SDK doesn't support it then English will be used.
    • english - force English language.
    • russian - force Russian language.
  • customLanguageStringsURL (optional) - URL to the custom localization file. Must be set in case of not system language set to language and custom text replaces needed to be applied (see customization texts).
  • showSupportScreen (optional) - special closure used to open or show support link or view.
  • appID (optional) - Appstore application ID. Could be used to show Appstore update screen in case SDK/app update required.
Verification object creation:
let configuration = Configuration()
configuration.apiURL = URL(string: "https://...")!
configuration.tokenProvider = ClosureTokenProvider() { completion in
		completion("JWT Token", nil)

let verification try = Verification(configuration: configuration)

It is recommended to create a new Verification object each time you want to start a verifaction process. Then you need to get the VerificationViewController object, setup its delegate and present it.

let verificationController = verification.verificationViewController()
verificationController.delegate = self
present(verificationController, animated: true, completion: nil)

By implementing the VerificationViewControllerDelegate you will get callbacks from the verification process about its success submit or cancellation.

// Verification finished and must be dismissed
func verification(_ viewController: VerificationViewController, didCompleteWith result: VerificationResult) {
    viewController.dismiss(animated: true, completion: nil) // Required step. ViewController will not dismiss automatically



You could customize the color palette via the UIScheme.shared singleton object.

If you need to customize a few colors then just call the configure(scheme:..) method:

UIScheme.shared.configure(scheme: ["errorColor": "121212"])
UIScheme.shared.configure(scheme: ["actionColorColor": "121212FA"])

If you need to customize all of them then you can create a separate .plist file or [String: String] object with the color list and load it via the loadScheme(from:..) method:

guard let filePath = Bundle.main.path(forResource: "custom-color-palette", ofType: "plist"),
    let schemeDictionary = NSDictionary(contentsOfFile: filePath) as? [String: String]
else { return }

UIScheme.shared.loadScheme(from: schemeDictionary)

Please note that there is one special color key - theme. It controls in general dark or light mode. Value must be one of the following strings: dark or light

Color themes

The SDK supports color themes: dark and light.

By default it use dark theme. Identance SDK ignores system defined theme instead of that it must be manually set before starting verification. To setup light theme call:


For dark one call:


Icons & Images

Icons and images inside the SDK could replaced by properly naming image resources inside main bundle of a host application. Use prefix zn__ and name of the SDK image resource. If image must be separate for dark and light theme then you could add suffix ~light to the end of light theme resource name (ex. zn__alert_icon~light).


In case you use allStages workingMode then you must properly fill LocalizationKeys.stageDescriptions with LocalizationStageDescription objects. Each object contains short (shortDescriptionKey) and full (fullDescriptionKey) description key for some stage (stage). SDK grab localized texts by these keys from host application localization files. Short description is text placed on a bottom of a stage cell. Full description is text placed on a screen when user tap on a stage cell. Full description text supports Markdown format including links. Proper LocalizationKeys object must be set to localizationKeys property of a verification Configuration instance before verification start.

In case you never use allStages and instead use singleStage workingMode then you could just set localizationKeys = .empty of a verification Configuration instance.

If some text in the SDK must be changed then you need to add appropriate strings key-pairs to default Localizable.strings file inside your application of appropriate language. Example of such pair:

"zn__button_yes" = "Yes";

All SDK keys start with zn__ so there won't be any conflict with your own keys. Try open contents of framework and find there Localizable.strings files inside language.lprog directories to search for key you want to replace.


Q: During project compilation get error: Command CompileSwiftSources failed with a nonzero exit code with detailed description error: using bridging headers with module interfaces is unsupported A: Usually this could be in case when Xcode project contains bridging header. Set target's BUILD_LIBRARY_FOR_DISTRIBUTION build setting to NO.

Q: During verification flow a user document scanning step absent on Simulator device. A: Simulator device doesn't have access to a camera so this step is automatically skipped. Because of that it is highly recommended to test verification flow on a real device.


Stars: 0
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

2 weeks ago

Bug fixes:

  • Fixed issue related with SSL validation

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics