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

Public methods

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