NEWSMRZ Scanner is now part of barKoder.What it means for you →

DOCUMENTATION

iOS

Native mobile

Documentation / Native mobile

On this page

The iOS SDK is a Swift package, MRZScannerAR, with the scanner core (MRZScannerCore.xcframework). It has a ready camera screen with AR mode, photo scanning, and the parts to build your own screen.

Needs: iOS 15 or later, Xcode with Swift Package Manager.

Install

  1. Download the iOS SDK from Downloads in the portal.
  2. In Xcode, add the MRZScannerAR folder to your project as a Swift package, and add the MRZScannerAR library to your app target.
  3. Add a camera usage text to Info.plist:
<key>NSCameraUsageDescription</key>
<string>Scans the MRZ of passports and ID cards.</string>

Register the key

Once, when the app starts:

import MRZScannerAR

let result = MRZScan.registerLicense("MRZ2...")   // {"status":0,"reason":null}

Scan with the camera

MRZScan.present opens the camera screen full screen and calls you back on the main thread when it has closed. Settings and results are JSON, as described in Scan settings and Scan results.

MRZScan.present(from: self, settings: #"{"documentTypes":["passport","id"]}"#) { resultJSON in
    // {"status":"read","reads":[{"text":"P<UTO...","fields":{...},"checkDigitsValid":true}], ...}
    print(resultJSON)
}

The screen asks for the camera permission itself.

Scan a photo

let readJSON = MRZScan.scanImage(#"{"path":"\#(photoURL.path)"}"#)   // an MrzRead as JSON, or "null"

Or, with a UIImage:

if let scanner = MRZImageScanner(), let read = scanner.scan(image) {
    print(read)
}

Your own screen

To put the scanner in your own view, use MRZARScanner with an AVCaptureVideoPreviewLayer and an MRZAROverlayView: attach(previewLayer:overlay:), then start(). setTorch and setZoom control the camera.

Updated Oct 24, 2026 ยท Questions? Ask us