Structured data extraction with ScanFlow on iOS

The scan flow also lets you create a scanner to extract structured data.

At this time, the scan flow only support bank details recognition (IBAN and BIC/SWIFT code scanning).

Prerequisites

This guide assumes that you have followed the simple integration guide.

Configure the scan flow for structured data recognition

To configure the scan flow for structured data, you need to configure the structured data type you are interested in extracting with the structuredData property on the GSKScanFlowConfiguration object.

We also recommend that:

  • you turn off multiPage, generally you are only interested in scanning the structured data on the first page.
  • you turn on the skipPostProcessingScreen option because you generally don’t need the user to review the scan.
let configuration = GSKScanFlowConfiguration()
configuration.structuredData = .bankDetails
configuration.multiPage = false
configuration.skipPostProcessingScreen = true

// Keep a strong reference on ScanFlow
self.scanFlow = GSKScanFlow(configuration: configuration)
scanFlow.start(from: viewController, onSuccess: { result in
    // Handle result
}, failure: { error in
    // Handle error
})

Access the recognized structured data

The recognized structured data is present in each scan of the result object:

// Handle result
if let iban = result.scans.first.structuredData?.bankDetails?.iban {
    print("IBAN detected: \(iban)")
}

if let bic = result.scans.first.structuredData?.bankDetails?.bic {
    print("BIC/SWIFT code detected: \(bic)")
}

Example

The Simple Demo shows how to use the scan flow to scan structured data.

© 2024 The Grizzly Labs. All rights reserved.