UserManager
@objc
public class UserManager : NSObject
Manage users and their face templates
-
Callback block with an array of face templates and optional error as parameters
Declaration
Swift
public typealias FaceTemplateArrayCallback = ([FaceTemplate], Error?) -> Void -
Callback block with an optional error as parameter
Declaration
Swift
public typealias ErrorCallback = (Error?) -> Void -
Callback block with an array of strings and optional error as parameters
Declaration
Swift
public typealias StringArrayCallback = ([String], Error?) -> Void -
Callback block with a number and optional error as parameters
Declaration
Swift
public typealias NumberCallback = (NSNumber, Error?) -> Void -
Callback block with a dictionary of face template arrays keyed by user ids strings and optional error as parameters
Declaration
Swift
public typealias FaceTemplateDictionaryCallback = (UserFaceTemplates, Error?) -> Void -
Dictionary of face template arrays keyed by user id strings
Declaration
Swift
public typealias UserFaceTemplates = [String : [FaceTemplate]] -
Assign face templates to a user
Note
If a user record with the given identifier does not exist it will be created. If any of the face templates are already assigned to a different user they will be reassigned to the specified user. If any of the face templates is the last remaining template for the user to whom they were previously assigned the user will be deleted. This method replaces the less performantaddFaceTemplates(_:to).Declaration
Swift
@available(*, message: "Introduced in Ver-ID 3.4.0") @objc public func assignFaceTemplates(_ faceTemplates: [FaceTemplate], to user: String) throwsParameters
faceTemplatesArray of face templates to assign to the user
userIdentifier for the user
-
Assign face templates to a user
Note
If a user record with the given identifier does not exist it will be created. If any of the face templates are already assigned to a different user they will be reassigned to the specified user. If any of the face templates is the last remaining template for the user to whom they were previously assigned the user will be deleted. This method replaces the less performantaddFaceTemplates(_:to).Declaration
Swift
@available(*, message: "Introduced in Ver-ID 3.4.0") @objc public func assignFaceTemplates(_ faceTemplates: [FaceTemplate], to user: String, completion: @escaping ErrorCallback)Parameters
faceTemplatesArray of face templates to assign to the user
userIdentifier for the user
completionBlock invoked on completion
-
Delete face templates
Note
If the given face templates are the last remaining face templates for a user the user will be deleted.Declaration
Swift
@available(*, message: "Introduced in Ver-ID 3.4.0") @objc public func deleteFaceTemplates(_ faceTemplates: [FaceTemplate]) throwsParameters
faceTemplatesArray of face templates to delete
-
Delete face templates
Note
If the given face templates are the last remaining face templates for a user the user will be deleted.Declaration
Swift
@available(*, message: "Introduced in Ver-ID 3.4.0") @objc public func deleteFaceTemplates(_ faceTemplates: [FaceTemplate], completion: @escaping ErrorCallback)Parameters
faceTemplatesArray of face templates to delete
-
Add face templates to a user identified by a string
Note
If a user record with the given identifier does not exist it will be created. If any of the face templates are already associated with another user they will be duplicated. To avoid this useassignFaceTemplates(_:to)instead.Declaration
Swift
@available(*, deprecated, message: "Deprecated in Ver-ID 3.4.0") @objc public func addFaceTemplates(_ faceTemplates: [FaceTemplate], to user: String) throwsParameters
faceTemplatesArray of face templates to associate with the user
userIdentifier for the user
-
Add face templates to a user identified by a string
Note
If a user record with the given identifier does not exist it will be created. If any of the face templates are already associated with the user they will not be duplicated.Declaration
Swift
@available(*, deprecated, message: "Deprecated in Ver-ID 3.4.0") @objc public func addFaceTemplates(_ faceTemplates: [FaceTemplate], to user: String, completion: @escaping ErrorCallback)Parameters
faceTemplatesArray of face templates to associate with the user
userIdentifier for the user
completionBlock invoked on completion
-
Retrieve user’s face templates
Declaration
Swift
@objc public func faceTemplates(for user: String) throws -> [FaceTemplate]Parameters
userIdentifier for the user for whom to retrieve templates
Return Value
Array of face templates associated with the user
-
Retrieve user’s face templates
Declaration
Swift
@objc public func faceTemplates(for user: String, completion: @escaping FaceTemplateArrayCallback)Parameters
userIdentifier for the user for whom to retrieve templates
completionBlock invoked on completion
-
Remove face templates from a user
Note
Face templates that are not associated with the user will be ignored. This method is replaced by the better-performingdeleteFaceTemplates(_).Declaration
Swift
@available(*, deprecated: 3.4.0) @objc public func removeFaceTemplates(_ faceTemplates: [FaceTemplate], from user: String) throwsParameters
faceTemplatesFace templates to dissassociate from the user
userIdentifier for the user from whom the face templates will be removed
-
Remove face templates from a user
Note
Face templates that are not associated with the user will be ignored. This method is replaced by the better-performingdeleteFaceTemplates(_:completion).Declaration
Swift
@available(*, deprecated: 3.4.0) @objc public func removeFaceTemplates(_ faceTemplates: [FaceTemplate], from user: String, completion: @escaping ErrorCallback)Parameters
faceTemplatesFace templates to dissassociate from the user
userIdentifier for the user from whom the face templates will be removed
completionBlock invoked on completion
-
Retrieve a list of user identifiers who are associated with at least one face template
Declaration
Swift
@objc public func users() throws -> [String]Return Value
Array of user identifiers who are associated with at least one face template
-
Retrieve a list of user identifiers who are associated with at least one face template
Declaration
Swift
@objc public func users(_ completion: @escaping StringArrayCallback)Parameters
completionBlock invoked on completion
-
Identify users whose face templates match the given face template
Declaration
Swift
@available(*, message: "Introduced in 3.4.0") @objc public func identifyUsers(in faceTemplate: FaceTemplate, securityLevel: VerIDSecurityLevel = .normal) throws -> [String]Parameters
faceTemplateFace template to which to compare user face templates
securityLevelSecurity level to use on the authentication
Return Value
Identifiers for users whose faces are similar to the supplied face template.
-
Identify users whose face templates match the given face template
Declaration
Swift
@available(*, message: "Introduced in 3.4.0") @objc public func identifyUsers(in faceTemplate: FaceTemplate, securityLevel: VerIDSecurityLevel = .normal, completion: @escaping StringArrayCallback)Parameters
faceTemplateFace template to which to compare user face templates
securityLevelSecurity level to use on the authentication
completionBlock invoked on completion. The block’s string array parameter contains identifiers for users whose faces are similar to the supplied face template.
-
Identify users whose face templates match the given face template
Declaration
Swift
@available(*, deprecated, message: "Use identifyUsers(in:securityLevel:﹚ instead") @objc public func identifyUsers(in faceTemplate: FaceTemplate, similarityThreshold: NSNumber) throws -> [String]Parameters
faceTemplateFace template to which to compare user face templates
similarityThresholdalue between
0.0and1.0ornilto use a default value of0.5Return Value
Identifiers for users whose face templates’ distance to the given template is greater than the similarity threshold
-
Identify users whose face templates match the given face template
Declaration
Swift
@available(*, deprecated, message: "Deprecated in 3.4.0, use identifyUsers(in:securityLevel:completion:﹚ instead") @objc public func identifyUsers(in faceTemplate: FaceTemplate, similarityThreshold: NSNumber, completion: @escaping StringArrayCallback)Parameters
faceTemplateFace template to which to compare user face templates
similarityThresholdValue between
0.0and1.0ornilto use a default value of0.5completionBlock invoked on completion. The block’s string array parameter contains identifiers for users whose face templates’ distance to the given template is greater than the similarity threshold.
-
Compare a face template to templates of a given user
Declaration
Swift
@objc public func compareFaceTemplate(_ faceTemplate: FaceTemplate, to user: String) throws -> NSNumberParameters
faceTemplateFace template to compare
userUser to whose face templates the given face template will be compared to
Return Value
Similarity score ranging from
0.0(no similarity) to1.0(same) -
Compare a face template to templates of a given user
Declaration
Swift
@objc public func compareFaceTemplate(_ faceTemplate: FaceTemplate, to user: String, completion: @escaping NumberCallback)Parameters
faceTemplateFace template to compare
userUser to whose face templates the given face template will be compared to
completionBlock invoked on completion. The block’s number parameter is a similarity score ranging from
0.0(no similarity) to1.0(same). -
Remove user record and its associated face templates
Declaration
Swift
@objc public func removeUser(_ id: String) throwsParameters
idUser identifier
-
Remove user record and its associated face templates
Declaration
Swift
@objc public func removeUser(_ id: String, completion: @escaping ErrorCallback)Parameters
idUser identifier
completionBlock invoked on completion
-
Remove user records and their associated face templates
Declaration
Swift
@objc public func removeUsers(_ ids: [String]) throwsParameters
idsUser identifiers
-
Remove user records and their associated face templates
Declaration
Swift
@objc public func removeUsers(_ ids: [String], completion: @escaping ErrorCallback)Parameters
idsUser identifiers
completionBlock to invoke on completion
-
Export all face templates
Declaration
Swift
@objc public func exportFaceTemplates() throws -> UserFaceTemplatesReturn Value
Dictionary of face template arrays keyed by user identifiers
-
Export all face templates
Declaration
Swift
@objc public func exportFaceTemplates(_ completion: @escaping FaceTemplateDictionaryCallback)Parameters
completionBlock invoked on completion. The block’s dictionary contains arrays of face templates keyed by user identifiers.
-
Import face templates
Note
If the user exists templates will be appended to the user recordDeclaration
Swift
@objc public func importFaceTemplates(_ faceTemplates: UserFaceTemplates) throwsParameters
faceTemplatesDictionary of face template arrays keyed by user identifiers to import
-
Import face templates
Note
If the user exists templates will be appended to the user recordDeclaration
Swift
@objc public func importFaceTemplates(_ faceTemplates: UserFaceTemplates, completion: @escaping ErrorCallback)Parameters
faceTemplatesDictionary of face template arrays keyed by user identifiers to import
completionBlock invoked on completion
UserManager Class Reference