FUIPasscodeInputController
@MainActor
public class FUIPasscodeInputController : FUIPasscodeController, FUIPasscodeViewDelegate
extension FUIPasscodeInputController: UITextFieldDelegate
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:
- Delegate: An implementation of
FUIPasscodeControllerDelegateto handle events from this controller. - hashUserPasscode: This boolean property needs to be the same as the same property in
FUIPasscodeCreateControllerthat was used to setup the passcode. - userIdentifier: This String property also needs to be the same as the same property in
FUIPasscodeCreateControllerthat was used to setup the passcode.
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
FUIPasscodeInputControllerstoryboard inSAPFioriUIframework bundle. App programmer needs to provide the properties needed inUIController‘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
@MainActor 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
didCancelPasscodeEntryfunction of the delegate will be invoked. The default is false.Declaration
Swift
@MainActor 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
@MainActor public var showsResetButton: Bool -
If this property is set to true, a “Reset Passcode” button will always be displayed, irrespective of the value assigned to
showsResetButton. The default value isfalse.Declaration
Swift
@MainActor public var showsResetButtonAlways: Bool -
This controller can create a hash of the user passcode to obfuscate the clear text user password. If enabled, the passcode given to
shouldTryPasscodeis derived from the user passcode. The default isfalse.Declaration
Swift
@MainActor public var hashUserPasscode: Bool -
If this property is true, user needs to input the passcode to authenticate even if Touch ID or Face ID is enabled. The default is
false.Declaration
Swift
@MainActor public var isRequiringAlphaNumericInput: Bool -
Creates a
FUIPasscodeInputControllerobject from storyboard.Declaration
Swift
@MainActor public class func createInstanceFromStoryboard() -> FUIPasscodeInputControllerReturn Value
A
FUIPasscodeInputControllerobject. -
Undocumented
Declaration
Swift
@MainActor public override func viewDidLayoutSubviews()