Advanced customization guide
This document outlines the advanced customization options available in the CardScan framework.
Parts of the scan flow can be customized to perform better on slower devices at the expense of some user experience on faster devices. These customization options are available in the SimpleScanViewController class.

Configuration

When instantiating SimpleScanViewController, you have the option to set scanPerformancePriority and maxErrorCorrectionDuration.
Note that you should only consider configuring the scan flow with devices iOS 13.0 and higher.
In markets that primarily have older iOS devices, we recommend that you add the following to your code before presenting the SimpleScanViewController:
Swift
Objective-C
1
@IBAction func pressSimpleScanViewControllerButton() {
2
let vc = SimpleScanViewController.createViewController()
3
vc.scanPerformancePriority = .accurate
4
vc.maxErrorCorrectionDuration = 4.0
5
vc.delegate = self
6
self.present(vc, animated: true)
7
}
Copied!
1
- (IBAction)pressSimpleScanViewControllerButton:(id)sender {
2
SimpleScanViewController *vc = [SimpleScanViewController createViewController];
3
vc.scanPerformancePriority = ScanPerformanceAccurate;
4
vc.maxErrorCorrectionDuration = 4.0;
5
vc.delegate = self;
6
[self presentViewController:vc animated:YES completion:nil];
7
}
Copied!
Note that settings these values will make the scan take longer overall, but with a much higher chance of extracting the name and expiry.

Fast Scan Performance

The fast scanning option is the default behavior for all scanning flows. It has a non-configurable maximum error correction duration of 2 seconds.
field
default value
SimpleScanViewController.scanPerformancePriority
fast
SimpleScanViewController.maxErrorCorrectionDuration
2.seconds

Accurate Scan Performance

The accurate scanning option is the configurable behavior for SimpleScanViewController. While the overall scan time will be much slower, the longer scan time can improve the accuracy of the name and expiry extraction.
field
default value
SimpleScanViewController.scanPerformancePriority
accurate
SimpleScanViewController.maxErrorCorrectionDuration
4.seconds