Skip to content

Passcode Create Controller

FUIPasscodeCreateController

public class FUIPasscodeCreateController: FUIPasscodeController, FUIPasscodeViewDelegate, FUITouchIDViewDelegate, FUIBlurNavigationBarViewController

This UIViewController is to be used by app to setup the passcode and enabling Touch ID screen flows.

Before the navigation controller presents this FUIPasscodeCreateController, the following property needs to be set:

  • Delegate: An implementation of FUIPasscodeControllerDelegate to handle events from this controller.

Application can also set this property for more passcode validation checks:

  • validationDelegate: An implementation of FUIPasscodeValidationDelegate to validate the passcode user entered.

Here is the screen flow:

  • The first screen is the Touch ID or Face ID screen, depends on the device capability, which prompts user to decide if enable Touch ID/Face ID authentication or not.

When there are fingerprints or Face ID enrolled, there will be one "Enable" button only. When user tapped this button, a passcode is generated and saved in a biometric ID protected keychain item. The shouldTryPasscode function of the delegate will be invoked with the generated passcode. User will then need to use Touch ID or Face ID in the FUIPasscodeInputController for the login flow.

When there is no fingerprints or Face ID enrolled, there will be one "Not Now" button, in addition to the "Enable" button. When "Not Now" is tapped, the second screen is shown to let user enter passcode. If "Enable" is tapped, in this case, an alert pop-up screen will be shown with two options, "Not Now" or "Settings". Tapping "Not Now" will dismiss the pop-up alert, while tapping "Settings" will open the Settings app to let user enroll fingerprints or Face ID.

  • The second screen prompts user to enter passcode. After user entered the passcode which is validated with the FUIPasscodePolicy. The FUIPasscodeValidationDelegate provided function validate of validationDelegate is invoked for additional validation. If validation success, the next screen will be displayed; otherwise, the function throws FUIPasscodeControllerError when validation fails.

  • The third screen prompts user to enter passcode again to verify with the passcode entered in the first screen. The function shouldTryPasscode of the FUIPasscodeControllerDelegate is invoked when passcode is verified.

When the function shouldTryPasscode of the FUIPasscodeControllerDelegate is invoked, the delegate should either create a secure store with the passcode, or save the passcode in a secure manner.

This passcode create flow is implemented in FUIPasscodeCreateController.storyboard. There are two ways to invoke it:

  • Use another story board and using a "Present Modally" segue to FUIPasscodeCreateController storyboard in SAPFiori's framework bundle "com.sap.cp.sdk.ios.SAPFiori". App programmer needs to provide the properties needed in UIController's prepare for segue function:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let destination = segue.destination as! UINavigationController
let vc0 = destination.viewControllers[0]
let vc = vc0 as! FUIPasscodeCreateController
//assigning a `FUIPasscodeControllerDelegate` delegate is a must
vc.delegate = passcodeControllerDelegate
}
  • Programmatically loads it:
let passcodeVC = FUIPasscodeCreateController.createInstanceFromStoryboard()

//assigning a `FUIPasscodeControllerDelegate` delegate is a must
passcodeVC.delegate = passcodeControllerDelegate

// present the passcode view
let navController = UINavigationController(rootViewController: passcodeVC)
self.navigationController?.present(navController, animated: true, completion: nil)

Theming

Supported style classes

fdlFUIPasscodeCreateController
fdlFUIPasscodeCreateController_navigationBar
fdlFUIPasscodeCreateController_cancelItem
fdlFUIPasscodeCreateController_nextItem
fdlFUIPasscodeCreateController_doneItem
fdlFUIPasscodeCreateController_changeMode_cancelItem
fdlFUIPasscodeCreateController_changeMode_nextItem
fdlFUIPasscodeCreateController_changeMode_doneItem

Last update: December 8, 2020