The Passport subclass defines the user ID information for all international passports (2-line MRZ).

Passport class

The Passport class 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

}

Methods

Method Result type Description
setFrontImage UIImage object Sets the UIImage passed as the value of the frontImage property.
getFrontImage UIImage object Gets the value of the frontImage property.
getFaceCoordinates CGRect object Gets the values of the id_face_coordinate_x, id_face_coordinate_y, id_face_width, and id_face_height properties.
setFirstName String Sets the value of the firstName property.
getFirstName String Gets the value of the firstName property.
setMiddleName String Sets the value of the middleName property.
getMiddleName String Gets the value of the middleName property.
setLastName String Sets the value of the lastName property.
getLastName String Gets the value of the lastName property.
setGender String Sets the value of the gender property.
getGender String Gets the value of the gender property.
setCountry String Sets the value of the country property.
getCountry String Gets the value of the country property.
setNationality String Gets the value of the nationality property.
getNationality String Gets the value of the nationality property.
setExpirationDate String Gets the value of the expirationDate property.
getExpirationDate String Gets the value of the expirationDate property.
setBirthDate String Gets the value of the birthDate property.
getBirthDate String Gets the value of the birthDate property.
setIdNumber String Gets the value of the idNumber property.
getIdNumber String Gets the value of the idNumber property.
setPersonalNumber String Gets the value of the personalNumber property.
getPersonalNumber String Gets the value of the personalNumber property.

Data model

Property Type Description
frontImage UIImage The complete front image (containing the user’s photo) of the user’s passport.
id_face_coordinate_x Int The x-axis coordinate of the user’s passport photo.
id_face_coordinate_y Int The y-axis coordinate of the user’s passport photo.
id_face_width Int The width of the user’s passport photo.
id_face_height Int The height of the user’s passport photo.
firstName String The user’s first name as shown on the passport.
middleName String The user’s middle name as shown on the passport.
lastName String The user’s last name as shown on the passport.
gender String The user’s gender as shown on the passport.
country String The user’s country of residence as shown on the passport.
nationality String The user’s country of birth as shown on the passport.
issueDate String The issue date of the user’s passport as shown on the passport.
expirationDate String The expiration date of the user’s passport as shown on the passport.
birthDate String The user’s date of birth as shown on the passport.
idNumber String The user’s passport number (2-line MRZ) as shown on the passport.
personalNumber String The user’s personal ID number as shown on the passport.