FUIPasscodeInputController

public class FUIPasscodeInputController : FUIPasscodeController, FUIPasscodeViewDelegate

This UIViewController is to be used by app to authenticate user by either Touch ID or Passcode.

Before the navigation controller presents this FUIPasscodeInputController, the following properties needs to be setup:

This controller will try to determine if Touch ID is enabled by retrieving the value from keychain. If Touch ID is enabled, there will be Touch ID authentication popup to prompt user authenticate with Touch ID.

If Touch ID authentication succeeded, the saved passcode will be retrieved and function shouldTryPasscode of the FUIPasscodeControllerDelegate implementation will be invoked.

If Touch ID authentication is canceled or failed, the passcode view will be shown to prompt user enter passcode. After user entered the passcode, function shouldTryPasscode of the FUIPasscodeControllerDelegate implementation will be invoked.

The delegate should dismiss this controller after the passcode is verified.

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

  • Use another story board and using a Present Modally segue to FUIPasscodeInputController storyboard in SAPFioriUI framework bundle. 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! FUIPasscodeInputController
     vc.delegate = passcodeControllerDelegate
 }

  • Programmatically loads it:

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

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

## Theming Supported style classes

 fdlFUIPasscodeInputController
 fdlFUIPasscodeInputController_doneItem
 fdlFUIPasscodeInputController_cancelItem
 fdlFUIPasscodeInputController_navigationBar
  • App may provide a custom background image to be displayed under the Touch ID authentication popup.

    Declaration

    Swift

    public var customBackgroundImage: UIImage?
  • If this property is true, a Cancel bar button item will be shown. When that Cancel bar button item is tapped, the didCancelPasscodeEntry function of the delegate will be invoked. The default is false.

    Declaration

    Swift

    public var showsCancelBarItem: Bool
  • If this property is true, a Reset Passcode button will be displayed when user entered a wrong passcode. The default is true.

    Declaration

    Swift

    public var showsResetButton: Bool
  • This controller can create a hash of the user passcode to obfuscate the clear text user password. If enabled, the passcode given to shouldTryPasscode is derived from the user passcode. The default is false.

    Declaration

    Swift

    public var hashUserPasscode: Bool
  • If this property is true, user needs to input the passcode to authenticat even if Touch ID or Face ID is enabled. The default is false.

    Declaration

    Swift

    public var isRequiringAlphaNumericInput: Bool
  • Creates a FUIPasscodeInputController object from storyboard.

    Declaration

    Swift

    public class func createInstanceFromStoryboard() -> FUIPasscodeInputController

    Return Value

    A FUIPasscodeInputController object.