Use PassportScannerViewController to capture the info page of an international passport, and return the resulting Passport object.

Initializing PassportScannerViewController

Initialize PassportScannerViewController.Builder with a completion block to receive the completion events with the result.

class YourViewController: UIViewController {

    override func viewDidAppear() {

        PassportScannerViewController.Builder(onComplete: { (isComplete, passport) in
            //Completion Block  
            if (isComplete) {
                //Handle Passport here
            } else {
                //ViewController cancelled 
        .setCheckHasFace(checkHasFace: true)
        .show(parentViewController: self)


Because a passport always contains a photo ID, you can set setCheckHasFace to indicate whether you want the scanner to confirm that there is at least one face present on the info page of the passport. setCheckHasFace is set to true by default.

The Passport object returned

PassportScannerViewController returns a Passport object containing the image of the info page for the scanned passport.

Currently, the scanner captures only the info page of the passport and doesn’t parse any metadata from the photo. The default values for all metadata properties is an empty string.

The returned Passport object looks like this:

open class Passport {

    public var cardId: String! //Unique ID to identify the card
    public var id_face_coordinate_x, id_face_coordinate_y, id_face_width, id_face_height: Int!
    internal var firstName, middleName, lastName, gender, country, nationality, expirationDate,
                 birthDate, idNumber, personalNumber: String!
    public var frontImage: UIImage!

    // You can use getters/setters for the properties to get/set the values. 
    // Values for id_face_coordinate_x, id_face_coordinate_y, id_face_width, id_face_height
    // can only be set internally by the library by calling `setFrontImage`

    // This method sets the property frontImage and throws an error if it cannot find a face  
    // on the image and also sets the properties id_face_coordinate_x, id_face_coordinate_y,
    // id_face_width, id_face_height
    public func setFrontImage(_ value: UIImage) throws 
    public func getFrontImage() -> UIImage

    // Translates and returns the properties id_face_coordinate_x, id_face_coordinate_y,
    // id_face_width, id_face_height to a CGRect
    public func getFaceCoordinates() -> CGRect

    public func setFirstName(_ value: String)
    public func getFirstName() -> String
    public func setMiddleName(_ value: String)
    public func getMiddleName() -> String
    public func setLastName(_ value: String)
    public func getLastName() -> String
    public func setGender(_ value: String)
    public func getGender() -> String
    public func setCountry(_ value: String)
    public func getCountry() -> String
    public func setNationality(_ value: String)
    public func getNationality() -> String
    public func setExpirationDate(_ value: String)
    public func getExpirationDate() -> String
    public func setBirthDate(_ value: String)
    public func getBirthDate() -> String
    public func setIdNumber(_ value: String)
    public func getIdNumber() -> String
    public func setPersonalNumber(_ value: String)
    public func getPersonalNumber() -> String