LivenessDetectionQuestion

A base class containing details pertaining to all different liveness detection questions

Declaration

@objc public class LivenessDetectionQuestion : NSObject, Encodable {
    @objc final public var actionLabel: String { get }
    @objc final public var actionCompleted: Bool { get }
    @objc final public var actionImage: UIImage? { get }
    @objc final public var actionImagePath: String? { get }
    @objc final public var croppedActionImage: UIImage? { get }
    @objc final public var croppedActionImagePath: String? { get }
    @objc final public var focusLabel: String { get }
    @objc final public var focusCompleted: Bool { get }
    @objc final public var focusImage: UIImage? { get }
    @objc final public var focusImagePath: String? { get }
    @objc final public var croppedFocusImage: UIImage? { get }
    @objc final public var croppedFocusImagePath: String? { get }
    
    @objc final public func saveImages()
    final public func encode(to encoder: Encoder) throws
}

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

Description

This is the main class whereby all the actions/questions are derived from.

The following actions/questions are currently available:

Each of the actions/questions are described in more detail in their respective pages.

Summary

Public variables

Name

Type

Description

String

The question instruction that was prompted to the user.

Bool

Indicates whether the user has completed the action.

UIImage?

An image of when the user triggered the action to be satisfied.

String?

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

UIImage?

The cropped version of actionImage, containing just the face.

String?

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

String

The instruction that will be prompted to the user after the question has been completed.

Bool

Indicates whether the user has focused back.

UIImage?

An image of when the user triggered the focus to be completed.

String?

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

UIImage?

The cropped version of focusImage, containing just the face.

String?

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

Public methods

Signature

Return Type

Description

Void

Saves the actionImage, croppedActionImage, focusImage and croppedFocusImage and populates their respective path variables.

Void

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

Public variables

actionLabel

@objc final public var actionLabel: String { get }

Example: "Close both eyes" (ref: BlinkLivenessDetectionQuestion)

The question instruction that was prompted to the user.

actionCompleted

@objc final public var actionCompleted: Bool { get }

Indicates whether the user has completed the action.

actionImage

@objc final public var actionImage: UIImage? { get }

An image of when the user triggered the action to be satisfied.

actionImagePath

@objc final public var actionImagePath: String? { get }

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

croppedActionImage

@objc final public var croppedActionImage: UIImage? { get }

The cropped version of actionImage, containing just the face.

croppedActionImagePath

@objc final public var croppedActionImagePath: String? { get }

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

focusLabel

@objc final public var focusLabel: String { get }

Example: "Open both eyes" (ref: BlinkLivenessDetectionQuestion)

The instruction that will be prompted to the user after the question has been completed.

focusCompleted

@objc final public var focusCompleted: Bool { get }

Indicates whether the user has focused back.

focusImage

@objc final public var focusImage: UIImage? { get }

An image of when the user triggered the focus to be completed.

focusImagePath

@objc final public var focusImagePath: String? { get }

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

croppedFocusImage

@objc final public var croppedFocusImage: UIImage? { get }

The cropped version of focusImage, containing just the face.

croppedFocusImagePath

@objc final public var croppedFocusImagePath: String? { get }

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

Public methods

saveImages()

@objc final public func saveImages()

Saves the actionImage, croppedActionImage, focusImage and croppedFocusImage and populates their respective path variables.

encode(to encoder: Encoder)

final 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