Load Model

Declaration

func loadModel(
    for identifier: String, 
    success: SybrinBiometrics.loadModelSuccessCallbackType? = nil, 
    failure: SybrinBiometrics.failureCallbackType? = nil
)

To view all the type aliases, go to the SybrinBiometrics class

Handling the success or failure callbacks are optional but recommended.

Calling the function

Parameters

Type

Description

String

The identifier you would like to load the model for.

Handling callback responses

success

The success callback will be executed after the session has finished and the view controller has been dismissed.

Parameters:

Type

Description

An object containing the results of the model that was loaded.

Example:

success: { (model) in
    print("Load model finished. Loaded model for \(model.identifier), it took \(model.timeTakenMilliseconds) milliseconds\(model.modelDownloaded ? " to download" : "")")
}

failure

The failure callback will be executed after the session has failed and the view controller has been dismissed.

Parameters:

Type

Description

String

A message describing the error.

Example:

failure: { (message) in
    print("Load model failed because \(message)")
}

Full Example

let identifier = "uniqueIdentifier"

SybrinBiometrics.shared.loadModel(for: identifier) { (model) in
    print("Load model finished. Loaded model for \(model.identifier), it took \(model.timeTakenMilliseconds) milliseconds\(model.modelDownloaded ? " to download" : "")")
} failure: { (message) in
    print("Load model failed because \(message)")
}

Last updated

Was this helpful?