MRZ

public struct MRZ

Structure for parsing and extracting data from a Machine Readable Zone (MRZ) of a travel document.

The MRZ typically contains information such as the document number, holder’s date of birth, expiry date, and more.

To use MRZ, provide a byte array representing the MRZ data and specify the type of travel document (TDType) to determine the data structure.

MRZ provides methods to extract various data fields from the MRZ, such as the document number, date of birth, expiry date, and so on, based on the specified document type.

Note

This structure is designed for parsing travel documents with Machine Readable Zones of type 1 (TD1), type 2 (TD2), or type 3 (TD3) conforming to ICAO standards.

See also

TDType and TravelDocument

  • Declaration

    Swift

    public var code: String? { get }
  • Declaration

    Swift

    public var documentCode: String? { get }
  • Declaration

    Swift

    public var issuingState: String? { get }
  • Declaration

    Swift

    public var holderName: String? { get }
  • Declaration

    Swift

    internal var surname: String? { get }
  • Declaration

    Swift

    internal var name: String? { get }
  • Declaration

    Swift

    public var documentNumber: String? { get }
  • Declaration

    Swift

    public var documentNumberCheckDigit: String? { get }
  • Declaration

    Swift

    public var nationality: String? { get }
  • Declaration

    Swift

    public var dateOfBirth: String? { get }
  • Declaration

    Swift

    public var dateOfBirthCheckDigit: String? { get }
  • sex

    Declaration

    Swift

    public var sex: String? { get }
  • Declaration

    Swift

    public var dateOfExpiry: String? { get }
  • Declaration

    Swift

    public var dateOfExpiryCheckDigit: String? { get }
  • Declaration

    Swift

    public var optionalData: String? { get }
  • Declaration

    Swift

    public var checkDigit: String? { get }
  • Declaration

    Swift

    public var compositeCheckDigit: String? { get }
  • Initialize MRZ from an array of bytes according to the specified provided TDType.

    Declaration

    Swift

    init(bytes: [UInt8], type: TDType)
  • Declaration

    Swift

    func parseDate(date: String) -> String?