IDCardModel

A class derived from DocumentModel containing details pertaining to all ID card documents

Declaration

@objc public class IDCardModel : DocumentModel {
    @objc public var fullName: String? { get }
    @objc public var sex: Sex { get }
    @objc public var nationality: String? { get }
    @objc public var identityNumber: String? { get }
    @objc public var dateOfBirth: Date? { get }
    @objc public var portraitBackImage: UIImage? { get }
    @objc public var documentBackImage: UIImage? { get }
    @objc public var croppedDocumentBackImage: UIImage? { get }
    @objc public var portraitBackImagePath: String? { get }
    @objc public var documentBackImagePath: String? { get }
    @objc public var croppedDocumentBackImagePath: String? { get }
    
    @objc override public func saveImages()
    override public func encode(to encoder: Encoder) throws
}

Only relevant details are shown, boilerplate or standard Swift generated code is omitted

Summary

Public variables

Name

Type

Description

Data source

String?

The full name of the subject as found on the ID card document.

OCR / MRZ / Barcode

The sex of the subject as found on the ID card document.

OCR / MRZ / Barcode

String?

The nationality of the subject as found on the ID card document.

OCR / MRZ / Barcode

String?

The identity number of the subject as found on the ID card document.

OCR / MRZ / Barcode

Date?

The date of birth of the subject as found on the ID card document.

OCR / MRZ / Barcode

UIImage?

The cropped version of documentBackImage, containing just the face.

Back of document

UIImage?

Contains an original image of the back side of the document.

Back of document

UIImage?

The cropped version of documentBackImage, containing just the document.

Back of document

String?

The path to portraitBackImage, after it is saved. Otherwise nil.

Local storage

String?

The path to documentBackImage, after it is saved. Otherwise nil.

Local storage

String?

The path to croppedDocumentBackImage, after it is saved. Otherwise nil.

Local storage

Public methods

Signature

Return Type

Description

Void

Saves the portraitBackImage, documentBackImage and croppedDocumentBackImage and populates their respective path variables.

Void

Encodes the model using the encoder provided. Used to convert the model to JSON.

Public variables

fullName

@objc public var fullName: String? { get }

Example: "John Doe"

The full name of the subject as found on the ID card document.

sex

@objc public var sex: Sex { get }

Example: Sex.Male

The sex of the subject as found on the ID card document.

nationality

@objc public var nationality: String? { get }

Example: "RSA"

The nationality of the subject as found on the ID card document.

identityNumber

@objc public var identityNumber: String? { get }

Example: "010203040506"

The identity number of the subject as found on the ID card document.

dateOfBirth

@objc public var dateOfBirth: Date? { get }

Example: 1990/01/01

The date of birth of the subject as found on the ID card document.

portraitBackImage

@objc public var portraitBackImage: UIImage? { get }

The cropped version of documentBackImage, containing just the face.

documentBackImage

@objc public var documentBackImage: UIImage? { get }

Contains an original image of the back side of the document.

croppedDocumentBackImage

@objc public var croppedDocumentBackImage: UIImage? { get }

The cropped version of documentBackImage, containing just the document.

portraitBackImagePath

@objc public var portraitBackImagePath: String? { get }

The path to portraitBackImage, after it is saved. Otherwise nil.

documentBackImagePath

@objc public var documentBackImagePath: String? { get }

The path to documentBackImage, after it is saved. Otherwise nil.

croppedDocumentBackImagePath

@objc public var croppedDocumentBackImagePath: String? { get }

The path to croppedDocumentBackImage, after it is saved. Otherwise nil.

Public methods

saveImages()

@objc override public func saveImages()

This function also calls its super function

Saves the portraitBackImage, documentBackImage and croppedDocumentBackImage and populates their respective path variables.

encode(to encoder: Encoder)

override public func encode(to encoder: Encoder) throws

This function also calls its super function

Encodes the model using the encoder provided. Used to convert the model to JSON.

See also

Where this is used

Last updated