Scans MRZ (Machine Readable Zone) from identity documents.
QKMRZScanner is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'QKMRZScanner'
Assign QKMRZScannerView
to the component responsible for displaying the camera view.
Subsequently connect this component to your UIViewController.
@IBOutlet weak var mrzScannerView: QKMRZScannerView!
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
mrzScannerView.startScanning()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
mrzScannerView.stopScanning()
}
In order to retrieve the scanning results you need to implement QKMRZScannerViewDelegate
.
class MRZScannerViewController: UIViewController, QKMRZScannerViewDelegate {
@IBOutlet weak var mrzScannerView: QKMRZScannerView!
override func viewDidLoad() {
super.viewDidLoad()
mrzScannerView.delegate = self
}
func mrzScannerView(_ mrzScannerView: QKMRZScannerView, didFind scanResult: QKMRZScanResult) {
print(scanResult)
}
}
This project is licensed under the MIT License - see the LICENSE file for details