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.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
@IBAction func pressSimpleScanViewControllerButton() {
let vc = SimpleScanViewController.createViewController()
vc.scanPerformancePriority = .accurate
vc.maxErrorCorrectionDuration = 4.0
vc.delegate = self
self.present(vc, animated: true)
}
- (IBAction)pressSimpleScanViewControllerButton:(id)sender {
SimpleScanViewController *vc = [SimpleScanViewController createViewController];
vc.scanPerformancePriority = ScanPerformanceAccurate;
vc.maxErrorCorrectionDuration = 4.0;
vc.delegate = self;
[self presentViewController:vc animated:YES completion:nil];
}
Note that settings these values will make the scan take longer overall, but with a much higher chance of extracting the name and expiry.
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 |
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 |
Last modified 1yr ago