FUIPasscodeCreateController

public class FUIPasscodeCreateController: FUIPasscodeController, FUIPasscodeViewDelegate, FUITouchIDViewDelegate

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:

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

Here is the screen flow:

  • The first 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 second screen prompts user to enter passcode again to verify with the passcode entered in the first screen. The third screen will be displayed when the passcode entered matched the passcode entered and touch ID is allowed in FUIPasscodePolicy.
  • The third screen prompts user to decide if enable Touch ID authentication or not. If user chooses Enable the passcode is saved as a Touch ID protected keychain item so that the passcode could be retrieved by FUIPasscodeInputController later with Touch ID.

After the setup is done, either with the third screen or not, 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
     vc.delegate = passcodeControllerDelegate
 }

  • Programmatically loads it:

 let storyboard = UIStoryboard(name: "FUIPasscodeCreateController", bundle: bundle)
 let vc = storyboard.instantiateViewController(withIdentifier: "PasscodeCreateFirstViewController")
 let passcodeVC = vc as! FUIPasscodeCreateController

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


  • An implementaiton of FUIPasscodeValidationDelegate for additional passcode validations.

    Declaration

    Swift

    public weak var validationDelegate: FUIPasscodeValidationDelegate?
  • This property indicates if the create passcode process includes a screen to enable TouchID or not. The default is true. Note that if there is no TouchID registered on the device, the enable TouchID screen will not be shown even if this property is true.

    Declaration

    Swift

    public var canEnableTouchID = true
  • App may set this link to other values. The default link URL is https://support.apple.com/en-us/HT201371. This link is to be used in the Touch ID screen with label Learn more about Touch ID

    Declaration

    Swift

    public var touchIDLearnMoreLink: URL? = URL.init(string: "https://support.apple.com/en-us/HT201371")
  • Creates a FUIPasscodeCreateController object from storyboard.

    Declaration

    Swift

    public class func createInstanceFromStoryboard() -> FUIPasscodeCreateController?

    Return Value

    A FUIPasscodeCreateController object.