SDK Documentation
  • Welcome!
  • Document Capture
    • Overview
    • Android Native SDK
      • Installation Guide
      • Implementation Guide
      • SDK Response
    • iOS Native SDK
      • Installation Guide
      • Implementation Guide
      • SDK Response
    • React Native Plugin
      • Installation Guide
      • Implementation Guide
      • Plugin Response
    • Flutter Plugin
      • Installation Guide
      • Implementation Guide
      • Plugin Response
    • Cordova Plugin
      • Installation Guide
      • Implementation Guide
      • Plugin Response
    • Release Notes
      • 🟦Latest Patch Release
      • Minor Release - 12/09/2024
      • Major Release - 11/06/24
      • Minor Release - 07/03/24
      • Minor Release - 30/11/23
      • Minor Release - 17/08/23
      • Minor Release - 03/07/23
      • Minor Release - 15/06/23
      • Minor Release - 15/03/23
      • Major Release - 02/04/23
    • 🆕Coming Soon
  • Biometrics
    • Overview
    • Android Native SDK
      • Installation Guide
      • Implementation Guide
      • SDK Response
    • iOS Native SDK
      • Installation Guide
      • Implementation Guide
      • SDK Response
    • React Native Plugin
      • Installation Guide
      • Implementation Guide
      • Plugin Response
    • Flutter Plugin
      • Installation Guide
      • Implementation Guide
      • Plugin Response
    • Cordova Plugin
      • Installation Guide
      • Implementation Guide
      • Plugin Response
    • Release Notes
      • 🟦Latest Patch Release
      • Minor Release - 17/08/23
      • Minor Release - 03/07/23
      • Minor Release - 15/03/23
      • Major Release - 02/04/23
  • SDK Error Codes
  • Support
    • Contact Us
    • Legacy SDKs
Powered by GitBook
On this page
  • Authentication
  • Delegate Confirmation
  • Initialization
  • Configurations
  • Configurations Breakdown
  • Start the SDK
  • Sample Integration Example
  1. Document Capture
  2. iOS Native SDK

Implementation Guide

PreviousInstallation GuideNextSDK Response

Last updated 2 months ago

Authentication

A unique access token should be created upon each SDK entry. In order to generate an access token, please refer to Valify's Documentation.

Security Warning: For improved security, consider implementing the access token fetching logic outside the Activity. This helps keep sensitive credentials secure and reduces potential exposure within the Activity/Fragment code.

Delegate Confirmation

Add the following delegate to your view controller.

class ViewController: UIViewController, VIDVOCRDelegate {}

SDK Events Delegate

Add the following delegate for the event logging component

class ViewController: VIDVLogsDelegate {

    func onOCRLog(log: VIDVOCR.VIDVEvent) {
        print("LOG Event 🏳️--------------")
        print("LOG key:", log.key ?? "")
        print("LOG sessionId:", log.sessionId ?? "")
        print("LOG date:", log.date)
        print("LOG timestamp:", log.timestamp ?? "")
        print("LOG type:", log.type ?? "")
        print("LOG screen:", log.screen ?? "")
    }
    
    func onOCRLog(log: VIDVOCR.VIDVError) {
        print("LOG Error 🚩--------------")
        print("LOG code:", log.code ?? 0)
        print("LOG message:", log.message)
        print("LOG sessionId:", log.sessionId ?? "")
        print("LOG date:", log.date)
        print("LOG timestamp:", log.timestamp ?? "")
        print("LOG type:", log.type ?? "")
        print("LOG screen:", log.screen ?? "")
    }
}

Initialization

Declare the following variables

var vidvOcrBuilder = OCRBuilder()

Configurations

The SDK builder is separated into two components.

Required Configurations

vidvOcrBuilder = vidvOcrBuilder
                .setBundleKey(bundleKey)
                .setBaseUrl(baseUrl)
                .setAccessToken(accessToken)

Optional Configurations

vidvOcrBuilder = vidvOcrBuilder
                .setlLanguage(language: String) // "en" is set as default
                .setDocumentVerificationPlus(valiudate: Bool) // false is set as default
                .setReturnValidationError(Bool) // false is set as default
                .setReviewData(review: Bool) // default is true
                .setPreviewCapturedImage(Bool) // default is false
                .setManualCaptureMode(Bool) // default is false
                .setHeaders(headers: [String: String]) // default is empty
                .setSSLCertificate(Data) // Inputstream for a certificate file, no default certificate
                .setCaptureOnlyMode(Bool) // default is false
                .setPrimaryColor(color: UIColor) // default is Valify’s primary color
                .setLogsDelegate(self)
                .setCollectUserInfo(Boolean) // enable/disablew user information collection
                .setAdvancedConfidence(Boolean) // default is false
                .setLogo(VIDVCustomLogo) // default is Valify's logo (.valify)

Configurations Breakdown

This section shows the breakdown of all optional builder configurations.

  1. The following line is where the user interface language is set.

.setlLanguage(language: String) // ["ar" or "en"] 

The currently supported languages are Arabic and English

  1. If the following line is set to true, an extra layer of data amd visual validations is added to the SDK response.

.setDocumentVerificationPlus(validate: Bool)
  1. If the following line is set to true, any validation exceptions raised on extracted NID data will be returned in the ServiceFailure instance.

.setReturnValidationError(Bool)
  1. If the following line is set to true, a screen is added to the user flow that displays the images captured and the OCR result to the user.

.setReviewData(review: Bool)
  1. If the following line is set to true, the captured image will be displayed for the user.

.setPreviewCapturedImage(boolean)
  1. If the following line is set to true, the SDK will automatically enable manual capture if it detects that the user is unable to autocapture card.

.setManualCaptureMode(boolean)
  1. The following line is optional and can be used to set any headers that may be required for purposes specific to your application. Any headers set will be sent along with each API call made by the SDK.

.setHeaders(headers: [String: String])
  1. The following line is optional and can be used to set an SSL certificate that may be required for purposes specific to your application.

.setSSLCertificate(Data)
  1. If the following line is set to true, the SDK purely performs image capturing and only returns these images in the SDK response.

.setCaptureOnlyMode(Bool) 
  1. The following line can be used to set your company's branding color to the SDK's user interface.

.setPrimaryColor(color: UIColor)
  1. The following line can be used to receive event logs from the SDK experience to be used for user behavior analysis.

.setLogsDelegate(self)
  1. If the following line is set to true then additional checks are made for NID fraud detection and the results are returned in the response.

.setAdvancedConfidence(Bool)
  1. Use the following line to configure the SDK's logo.

.setLogo(VIDVCustomLogo)
public enum VIDVCustomLogo {
    case empty // No logo will be displayed
    case valify // Uses the default Valify logo
    case customLogo(logo: UIImage) // Displays a custom logo provided as a UIImage
}

Start the SDK

Use the following code snippet to run the SDK

vidvOcrBuilder.start(vc: self, ocrDelegate: self) 

Sample Integration Example

Check out our for a simple integration app demonstrating how to use our SDK. The repository includes step-by-step instructions and sample code to help you get started quickly.

Authentication
GitHub repository