GBG Developers

Guides   |   Versions


Release Notes

 The Guides all reflect the latest version of the SDKs.  Information about previous versions can be found in this section.

Version 1.3 (latest)

  • MJCS version installed (10.0.0)
    • Including on device components FaceMatch & Liveness updates
  • Use Identity Solution API versions
    • Verify Person v4
    • Verify Document v4
    • Verify Selfie v1
    • Address Capture v1.0


Version 1.0

  • MJCS version installed (8.3.1)
    • Including on device components FaceMatch & Liveness updates
  • Use Identity Solution API versions
    • Verify Person v3
    • Verify Document v2
    • Verify Selfie v1
    • Address Capture v1.0



Migration from 1.0 to 1.3

 The following pages were changes.  Please review the corresponding guide pages to ensure refresh of necessary components:

  1. Initialize the SDK
  2. Using the Document Service

  For reference the v1.0 pages are archived below as follows:


Initialize the SDK

Importing Modules

The SDK is modular and the SDK services are imported into the application code as show here:

import UIKit
import GBGCore
import GBGAddressLookup
import GBGPeopleVerify
import GBGFaceMatch
import GBGDocument
import GBGLiveness

Import the modules that are needed in each code file that requires them. Importing the GBGCore module is essential in each of those code files, in order to use the SDK for any service.

As an example, if a code file performs address lookup, then import both GBGCore and GBGAddressLookup modules in that file.

if a code file is using the Liveness service, it is important to import GBGCore and both GBGLiveness and IDSLiveness in that file.

Initializing the SDK

At the start of the application code (for example in the AppDelegate.swift source code file) import all of the modules listed above apart from IDSLiveness and then call the GBGVerifySDK.initialize function to initialize the SDK. Here is an example fragment demonstrating how all the SDK services can be initialized; GBGCore needs to be initialized first and the remainder can occur in any order:


GBGVerifySDK.initialize(GBGCore.self, GBGAddressLookup.self, GBGPeopleVerify.self, GBGFaceMatch.self, GBGDocument.self, GBGLiveness.self)


Using the Document Service


This service allows for a document image (such as a passport or driving license) to either be transferred from an image file or bitmap source, or for an image to be taken with the camera in the mobile device and transferred. The camera method can prompt the user to assist in the document scan, and it is known as Smart Capture.

After the document image has been uploaded the GBG service will analyse it to perform a verification and return the result.

Here is an example which uses Smart Capture.

First, the camera permission needs to be enabled. Go to the info.plist file and in the Information Property List add the property Privacy – Camera Usage Description and set the Value field to any suitable description text.

Create a verifyDocumentScanner variable that you will use later:

private var verifyDocumentScanner: GBGVerifyDocumentScanner!

Next, create a GBGVerifyDocumentScanner object, set to type .document. The smart capture can be launched by calling the present method:

verifyDocumentScanner = GBGVerifyDocumentScanner(scannerType: .document, options: nil, delegate: self)

Your code will need a delegate that will be invoked at different stages. The following code can be used:

extension StartVerifyDocumentViewController: GBGVerifyDocumentScannerDelegate {
    func documentScannerController(didFinishScanning model: GBGVerifyDocumentScannerModel?) {
        print("success, doc captured by camera")
    func documentScannerControllerDidCancel() {
        print("Cancelled the model from the document")
    func documentScannerController(didFailWithError error: Error?) {
        print("Failed to get the model from the document")

If the document has been successfully captured by the camera, a success message will be printed in the console. At that point the scanned image can be sent to the GBG service in order to perform the document verification. The code snippet below can be used in the documentScannerController function.

The snippet performs several tasks. Firstly it creates an instance of GBGVerifyDocumentService, and then creates a GBGImage object containing the scanned image, and sets the document processing tolerance to default (this is the usual setting for testing and deployment, unless a stricter policy is required). The verify method is called to send the document image to the GBG cloud service.

If the document is successfully processed, fields from the result can be extracted. The example code here places some of the fields into the GBGVerifyResponseManager object which is a singleton instance that provides storage and access to the fields, so that they can be subsequently used with other services in the SDK.

if let model = model {
    let documentService = GBGVerifyDocumentService()
    let image = GBGImage(image: model.extractedImage, fileName: "sample-ios", mimeType: .png)
    let documentIdRequestHeader = GBGVerifyDocumentRequestHeader().withTolerance(GBGTolerance.default.rawValue)
    documentService.verify( document: image, documentRequestHeader: documentIdRequestHeader, success: { result in
        if let verificationId = result?.response.response?.allHeaderFields["verification-id"] as? String,
            let personId = result?.response.response?.allHeaderFields["person-id"] as? String,
            let documentId = result?.response.response?.allHeaderFields["document-id"] as? String {
            GBGVerifyResponseManager.shared.documentId = documentId
            GBGVerifyResponseManager.shared.personId = personId
            GBGVerifyResponseManager.shared.verificationId = verificationId
            print("success, document verified: \(result)")
    }) { error in
        print("Error when submitting the request to the document service: \(error)")
        if let error = error as? GBGErrorResponse<String> {
            self.showPopup(title: "Status Code: - \(String(describing: error.response?.statusCode))", message: error.body ?? "")
} else {       
    print("Failed to get the model from the document")

When the code is run, after a document capture has been performed, the image will be sent to the GBG service and upon successful return you should see a message in the console.

The screenshot below shows an example document scan using the Smart Capture capability. The overlay helps the user frame their document correctly.