FUIPasscodeCreateController

public class FUIPasscodeCreateController : FUIPasscodeController, FUIPasscodeViewDelegate, FUITouchIDViewDelegate
extension FUIPasscodeCreateController: UITextFieldDelegate

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 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. 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
  • 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: 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, the navigation bar will have white background with dark text for setting up the passcode. Otherwise, the navigation bar will be dark background with white text. The default is true.

    Declaration

    Swift

    public var isWhiteNavigationBar: Bool
  • 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?
  • App may set this link to other values. The default link URL is “https://support.apple.com/en-us/HT208108”. This link is to be used in the Face ID screen with label “Learn more about Face ID”

    Declaration

    Swift

    public var faceIDLearnMoreLink: URL?
  • The app may set this link to other values. The default link URL is “https://www.apple.com/apple-vision-pro/”. This link is to be used in the Optic ID screen with the label “Learn more about Optic ID.”

    Declaration

    Swift

    public var opticIDLearnMoreLink: URL?
  • 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 true.

    Declaration

    Swift

    public var showsCancelBarItem: Bool
  • This property indicates if enable biometric ID is optional or not in Touch ID or Face ID screen. When this is true, there are “Enable” and “Not Now” buttons. If this property is false, there is only the “Enable” button. The default is true.

    Declaration

    Swift

    public var isBiometricIDEnablementOptional: Bool
  • Creates a FUIPasscodeCreateController object from storyboard.

    Declaration

    Swift

    public class func createInstanceFromStoryboard(_ usesTouchID: Bool = true) -> FUIPasscodeCreateController

    Parameters

    usesTouchID

    Indicates if the Touch ID view should be included or not. The default is true.

    Return Value

    A FUIPasscodeCreateController object.

  • Creates a FUIPasscodeCreateController which contains only the Touch ID or Face ID screen. This is to be used to enable using biometric ID to login after passcode policy changed from not allows to allows Touch ID to login.

    The delegate function didSetBiometricIDOption will be invoked after user tapped either the ‘Enable’, or ‘Not Now’ button. It is the delegate’s responsibility to obtain the passcode from user and invoke FUIPasscodeController‘s class function enableBiometricID to actually enable the class

    Declaration

    Swift

    public class func createInstanceForEnablingBiometricID(userIdentifier: String? = nil, keychainAccessGroup: String? = nil) -> FUIPasscodeCreateController?

    Parameters

    userIdentifier

    The user identifier string for the passcode.

    keychainAccessGroup

    The keychain access group string.

    Return Value

    The FUIPasscodeCreateController which only has the Touch ID or Face ID view. This function returns nil if the device does not support biometric ID. Or, if using Touch ID or Face ID is already enabled.

  • Undocumented

    Declaration

    Swift

    public override func viewDidLayoutSubviews()