The scan flow also lets you create a scanner to extract structured data.
The scan flow is able to extract the following structured data:
This guide assumes that you have followed the simple integration guide.
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:
multiPage
, generally you are only interested in scanning the structured data on the first page.skipPostProcessingScreen
option because you generally don’t need the user to review the scan.let configuration = GSKScanFlowConfiguration()
// You can specify a single or multiple structured data to extract
configuration.structuredData = [.bankDetails, .receipt, .businessCard]
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
})
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)")
}
The Simple Demo shows how to use the scan flow to scan structured data.
© 2024 The Grizzly Labs. All rights reserved.