QITechIosFaceRecognitionConfiguration
SDK 7.0.0 and later
let onboardingTextConfiguration = OnboardingTextConfiguration(
onboardingTitle: "Relevant tips",
onboardingFirstLabel: "Keep your face visible",
onboardingSecondlabel: "Fit your face in the oval",
onboardingThirdLabel: "Remove accessories that cover your face"
)
let faceRecognitionConfig = QITechIosFaceRecognitionConfiguration(
environment: QITechIosFaceRecognitionEnvironment.sandbox,
clientSessionKey: clientSessionKey,
sessionId: "7d8c6f9a-f222-450d-9501-a07c68eb2388",
documentNumber: "123.456.789-00",
fontColor: "#337DFF",
backgroundColor: "#C9CCD3",
fontFamily: .open_sans,
showIntroductionScreens: true,
showSuccessScreen: true,
showInvalidTokenScreen: false,
audioConfiguration: AudioConfiguration.enable,
onboardingTextConfiguration: onboardingTextConfiguration,
logLevel: .debug
)
Versions prior to v7.0.0
let visualConfiguration = VisualConfiguration()
visualConfiguration.setOnboarding(onboardingFilePath: Bundle.main.path(forResource: "onboarding", ofType: "png")!, onboardingWidth: 200)
let textConfiguration = TextConfiguration()
textConfiguration.setCustomText(on: .onboardingTitle, text: "To take a good photo:")
textConfiguration.setCustomText(on: .onboardingFirstLabel, text: "- Go to a well-lit place")
textConfiguration.setCustomText(on: .onboardingSecondLabel, text: "- Remove accessories and show your face clearly")
textConfiguration.setCustomText(on: .onboardingThirdLabel, text: "- Insert your face into the frame, waiting for it to turn green to capture")
let faceRecognitionConfig = QITechIosFaceRecognitionConfiguration(environment: QITechIosFaceRecognitionEnvironment.Sandbox,
clientSessionKey: clientSessionKey,
sessionId: "7d8c6f9a-f222-450d-9501-a07c68eb2388",
backgroundColor: "#C9CCD3",
fontColor: "#337DFF",
fontFamily: .open_sans,
showIntroductionScreens: true,
showSuccessScreen: false,
showInvalidTokenScreen: true,
activeFaceLiveness: true,
audioConfiguration: AudioConfiguration.Enable,
logLevel: .debug
)
faceRecognitionConfig.setVisualConfiguration(visualConfiguration: visualConfiguration)
faceRecognitionConfig.setTextConfiguration(textConfiguration: textConfiguration)
The QITechIosFaceRecognitionConfiguration class is used so you can configure environment, credentials, visual and textual aspects, that is, all the necessary configurations for SDK personalization and operation.
In the table below you will find the details of all arguments that should be used in its instantiation:
| name | type | description |
|---|---|---|
| environment | QITechIosFaceRecognitionEnvironment | (required) Enumerator that describes the environment. |
| clientSessionKey | string | (required) Token sent by the face recognition API for SDK authentication. |
| sessionId | string | (optional) Unique ID used to track the entire flow taken by the user in FaceRecon execution through logs. This field accepts up to 255 characters. |
| documentNumber | string | (optional) Used for user identification for anti-fraud and internal security |
| fontColor | string | (optional) Hexadecimal of the font color. If not specified, the default is #1C49A5. |
| backgroundColor | string | (optional) Hexadecimal of the screen background color. If not specified, the default is #FCFCFC. |
| fontFamily | FontFamily | (optional) Font family. If not specified, the default is .open_sans. Available fonts: .open_sans, .futura, .verdana, .trebuchetms, .tamilsangammn and .system_font. |
| showIntroductionScreens | boolean | (optional) Flag that indicates whether the introduction screens, with instructions on how the photo should be captured, should be shown. If not specified, the default is true. |
| showSuccessScreen | boolean | (optional) Flag that indicates whether the success screen, with the success message on capture, should be shown. If not specified, the default is true. |
| showInvalidTokenScreen | boolean | (optional) Flag that indicates whether the authentication failure screen, with the token expiration message, should be shown. If not specified, the default is true. |
| audioConfiguration | AudioConfiguration | (optional) Configures the SDK spoken voice guidance, which narrates the capture instructions in real time. Accepted configurations are: Enable, which shows the audio on/off button with narration starting muted; Disable, which disables narration and hides the button; and Accessibility, which shows the button with narration starting enabled when the device has accessibility features active. With VoiceOver active, the full instructions are delivered by the screen reader itself. |
| language | String | (optional) Sets the language of the SDK screens, accessibility messages and voice guidance, as a BCP 47 tag (for example pt-BR, en, es or zh-Hans). Supported languages: Portuguese (pt, pt-BR), English (en, en-US), neutral Spanish (es, es-MX, es-419) and Simplified Chinese (zh, zh-Hans, zh-CN). The tag is case-insensitive and _ is also accepted as a separator (pt_BR). An unsupported tag (such as fr or zh-TW) shows the SDK in English and logs a warning. The device language is not taken into account. If not provided, the default is Portuguese. |
| onboardingTextConfiguration | OnboardingTextConfiguration | (optional) Allows configuring the instruction screen texts |
| logLevel | LogLevel | (optional) Used to customize the verbosity level of the SDK logs. Available levels: LogLevel.debug, LogLevel.info, LogLevel.warn, LogLevel.error and LogLevel.trace. If not specified, the default is LogLevel.debug. |
Language
- The SDK never uses the device language: your integration chooses it. To follow your app's language, pass its tag, for example
Locale.current.identifier. - Custom onboarding texts (
onboardingTextConfiguration) are shown exactly as provided. Send them already translated into the chosen language. - Voice guidance speaks in the chosen language when the device has a voice installed for it. Otherwise, the SDK narration stays off for that session. VoiceOver still announces the instructions in the chosen language.
In the table below you will find all methods accepted by the instance for configuration:
warning
DEPRECATED AS OF v7.0.0!
| method | arguments | description |
|---|---|---|
| setVisualConfiguration | visualConfiguration : VisualConfiguration | (optional) Class that allows modification of images displayed during SDK execution; |
| setTextConfiguration | textConfiguration : TextConfiguration | (optional) Class that allows modification of texts displayed during SDK execution; |
| setDocumentNumber | Used to define the user's document number. This field accepts 14 characters of CPF formatted as follows 000.000.000-00 | Yes in all calls if using 1:1 validation at some point. |
| setValidation | Used to define whether the SDK should or should not perform 1:1 validation with the user's selfie. In the user's first session this flag must be mandatorily false. This function requires the setDocumentNumber method to be filled. | No. Default is false. |