Prerequisites

These are the frameworks you must have before starting to use OCRLabs SDKs:

  • Xcode Project or an equivalent IDE for IOS development.
  • Minimum IOS SDK version: 8.
  • The latest SDK files (version 3.6.1503.2022) and Code Sample App from your Account Manager.

Step 1: Create a New Project

Create a new project or open a new one. To create a new project:

  • Open Xcode Project.
  • Create a new project.
  • Select App > Next.
  • Fill in the general settings of the Project once you are done, and click Next.
  • Select the Folder to place your project.

create a new projectcreate a new project

Step 2: Add the Frameworks to the Project

Add the three frameworks to your project by clicking:

  • Click General > frameworks, Libraries, and Embedded Content section
  • Select +clickable button > add files > select the three frameworks.

Add the FrameworksAdd the Frameworks

Step 3: Import the Framework

Insert the following code to import your Framework to the Project folder > ViewController.

import Orbit4ScanID
import OrbitMrz
import Orbit4Medicare

Import the FrameworksImport the Frameworks

📘

Note:

4ScanID is the Binding.

Step 4: Give Permission for the Framework to Start the Camera

Give permission to your framework for your project by:

  • Clicking the Project > Info > Privacy Camera Usage > on the Value section type in "app uses a camera to scan your Id document."

Give PermissionGive Permission

Step 5: Create Three Buttons

To create three buttons for the three frameworks by:

  • Clicking Project Folder > Main to create the three buttons.
859859

Step 6: Create Function for the Buttons

Make the functions for the three buttons by:

  • Clicking on your Project > Main
  • Split the Screen between the Main file and the ViewController file
  • Drag the button to the ViewController to create the button function.

Create functionCreate function

Step 7: Initialize the Framework

Implement the button with the framework to initialize the framework by:

  • Click on your Project Folder > ViewController.
  • Insert the following code under the Id card Button's function on ViewController.
if let scanidVC = Orbit4ScanIDViewController.init(delegate: self) {
}
  • Insert the following code under the Medicare Button's function on ViewController.
if let orbitMedicareVC = Orbit4MedicareViewController.init(delegate: self) {
}
  • Insert the following code under the Passport Button's function on ViewController.
if let mrzVC = OrbitMrzViewController.init(delegate: self) {
}

Create functionCreate function

Step 8: To finalize the Implementation

To finalize the implementation you need to insert the result code under the button function.

  • Insert the following Result code under the class ViewController for the Idscan framework initialization to be implemented.
extension ViewController: Orbit4ScanIDResultDelegate {
  func responseOrbit4ScanIDResult(_ sdkViewController: Orbit4ScanIDViewController!, result: ScanIDOCRResult!, imageDocFront imgDocF: UIImage!, imageDocBack imgDocB: UIImage!, imgDocFace: UIImage!, imageCameraFace imgCamFace: UIImage!) {
    sdkViewController.dismiss(animated: true)
  }
}
  • Insert the following Result code under the class ViewController for the Medicare framework initialization to be implemented.
extension ViewController: Orbit4MedicareResultDelegate {
  func responseOrbit4MedicareResult(_ sdkViewController: Orbit4MedicareViewController!, result: MedicareOCRResult!, frontImage: UIImage!, back backImage: UIImage!, face faceImage: UIImage!) {
    sdkViewController.dismiss(animated: true)
  }
}
  • Insert the following Result code under the class ViewController for the Passport framework initialization to be implemented.
extension ViewController: OrbitMrzViewControllerDelegate {
  func responsed(_ response: MRZOCRResult!, with image: UIImage!, in mrzViewController: OrbitMrzViewController!) {
    sdkViewController.dismiss(animated: true)
  }
}

finalizefinalize

Step 9: Set the Document Type

Set the valid document type by:

  • Insert the following code for the Id card under the initialization function.
scanidVC.requestParam = ""
  • Insert the following code for Medicare under the initialization function.
orbitMedicareVC.requestParam = ""

set documentset document

To see the full list of the compatible documents for Id cards:

  • Right-click the Orbit4ScanidViewController.
  • Select Jump to Definition.

To see the full list of the compatible documents for Medicare:

  • Right-click the Orbit4MedicareViewController.
  • Select Jump to Definition.

To see the full list of the compatible documents for Passport:

  • Right-click the OrbitMrzViewController.
  • Select Jump to Definition.

set documentset document

Step 10: Set the Customization

You can set the customization for each of the buttons, this is optional.
To see the full list of available customization for Id cards:

  • Right-click the Orbit4ScanidViewController.
  • Select Jump to Definition.

To see the full list of available customization for Medicare:

  • Right-click the Orbit4MedicareViewController.
  • Select Jump to Definition.

To see the full list of available customization for Passport:

  • Right-click the OrbitMrzViewController.
  • Select Jump to Definition.

set documentset document

Step 11: Set the code to Handle the Result

Set the code to handle the result by:

  • Insert the following code under each of the extension result functions.
if result.statusCode == "200" {
  print(result.resultString)
} else {
  print(result.statusCode)
  print(result.statusMessage)
}

resultresult

To see the full list of the status codes and messages for the Id card:

  • Right-click the ScanIDOCRResult.
  • Select Jump to Definition.

To see the full list of the status codes and messages for the Medicare:

  • Right-click the MedicareOCRResult.
  • Select Jump to Definition.

To see the full list of the status codes and messages for the Passport:

  • Right-click the MRZOCRResult.
  • Select Jump to Definition.

resultresult

Step 12: Set the SDK Function

Set the SDK function by:

  • Click on your Project Folder > ViewController.
  • Insert the following code under the override function.
func usedSdkFunctions() {
  let sdkVersion = Orbit4ScanIDViewController.sdkVersion()
  let sdkBuildDate = Orbit4ScanIDViewController.sdkBuildDate()
  let supportedCountries = Orbit4ScanIDViewController.getSupportedCountries()
  let supportedDocuments = Orbit4ScanIDViewController.getSupportedDocumentTypes(withCountry: "")
}
13351335

💬 We're here to help!

If you encounter an issue, a bug, or require assistance, please contact our support page here to find the solution. Don't forget to provide any important information on the issue.