Skip to content

Scan MRZ (Machine Readable Zone) from identity documents (passport, id, visa) using iPhone/iPad (iOS)

License

Notifications You must be signed in to change notification settings

decentralised-dataexchange/QKMRZScanner

 
 

Repository files navigation

SwiftPackageSupport Swift 5 Git

QKMRZScanner

Scans MRZ (Machine Readable Zone) from identity documents.

scanning_preview

Installation

Swift Package Manager

For better M1 & SPM support please see master-spm.

CocoaPods

QKMRZScanner is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'QKMRZScanner'

Please note: Xcode 12 and CocoaPods >= 1.10.0.rc.1 is recommended. More info here.

Setup

Assign QKMRZScannerView to the component responsible for displaying the camera view.

storyboard_setup

Subsequently connect this component to your UIViewController.

@IBOutlet weak var mrzScannerView: QKMRZScannerView!

Start scanning

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    mrzScannerView.startScanning()
}

Stop scanning

override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    mrzScannerView.stopScanning()
}

Scanning Result

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)
    }
}

License

This project is licensed under the MIT License - see the LICENSE file for details

About

Scan MRZ (Machine Readable Zone) from identity documents (passport, id, visa) using iPhone/iPad (iOS)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 93.1%
  • Ruby 4.8%
  • Objective-C 2.1%