DocumentModel

A base class containing images for a scanned document

Declaration

@objc public class DocumentModel : NSObject, Encodable {
    @objc public var portraitImage: UIImage? { get }
    @objc public var documentImage: UIImage? { get }
    @objc public var croppedDocumentImage: UIImage? { get }
    @objc public var portraitImagePath: String? { get }
    @objc public var documentImagePath: String? { get }
    @objc public var croppedDocumentImagePath: String? { get }
    
    @objc public func saveImages()
    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

UIImage?

The cropped version of documentImage, containing just the face.

Front of document

UIImage?

Contains an original image of the document.

Front of document

UIImage?

The cropped version of documentImage, containing just the document.

Front of document

String?

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

Local storage

String?

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

Local storage

String?

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

Local storage

Public methods

Signature

Return Type

Description

Void

Saves the portraitImage, documentImage and croppedDocumentImage and populates their respective path variables.

Void

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

Public variables

portraitImage

@objc public var portraitImage: UIImage? { get }

The cropped version of documentImage, containing just the face.

documentImage

@objc public var documentImage: UIImage? { get }

Contains an original image of the document.

croppedDocumentImage

@objc public var croppedDocumentImage: UIImage? { get }

The cropped version of documentImage, containing just the document.

portraitImagePath

@objc public var portraitImagePath: String? { get }

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

documentImagePath

@objc public var documentImagePath: String? { get }

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

croppedDocumentImagePath

@objc public var croppedDocumentImagePath: String? { get }

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

Public methods

saveImages()

@objc public func saveImages()

Saves the portraitImage, documentImage and croppedDocumentImage and populates their respective path variables.

encode(to encoder: Encoder)

public func encode(to encoder: Encoder) throws

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

Where this is used

Last updated