FUIPasscodeController
open class FUIPasscodeController : UIViewController, FUIPrivateEncryptionKeyGenerator, FUISolidNavigationBarProtocol, UIScrollViewDelegate
This is the base class of FUIPasscodeCreateController
and FUIPasscodeInputController
.
It has the common codes for those two view controllers.
Note that both Passcode screen and Touch ID screen are supported for iPad portrait and landscape orientation and iPhone portrait orientation only.
Since the screens are not supported in iPhone landscape orientation, the app installed in iPhone needs to switch to portrait mode before presenting these screens.
And AppDelegate
needs to lock the screen orientation when these screens are shown, similar to the following code snippet.
In app’s AppDelegate
:
public var inPasscodeView: Bool = false
// implement this function to support only portrait orientation when FUPasscodeView is displayed in iPhone.
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
if !inPasscodeView {
return .allButUpsideDown
} else {
return .portrait
}
}
Before presenting the Passcode or Touch ID screen:
// Let `AppDelegate` know that we are entering FUIPasscodeView
(UIApplication.shared.delegate as! AppDelegate).inPasscodeView = true
// Make sure we rotate to portrait mode
let value = UIInterfaceOrientation.portrait.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
// Present the passcode view
self.navigationController?.present(navController, animated: true, completion: nil)
After dismissing the Passcode or Touch ID screen:
passcodeController.dismiss(animated: true, completion: nil)
// Let `AppDelegate` know that we are exiting FUIPasscodeView
(UIApplication.shared.delegate as! AppDelegate).inPasscodeView = false
The strings used in FUIPasscodeSetupView
, FUIPasscodeView
, and FUITouchIDView
are from localized Onboarding.strings file.
Application can override these strings by setting the corresponding static
variables in this FUIPasscodeController
class at runtime.
Theming
Supported style classes
fdlFUIPasscodeController
fdlFUIPasscodeController_navigationController_navigationBar
Attention
The delegate object with type FUIPasscodeControllerDelegate
is declared as a weak reference. On deallocation it will be automatically set to nil. To keep it alive as expected, developer should retain the delegate object during its whole execution scope.
-
The
FUIPasscodeControllerDelegate
implementation.Declaration
Swift
public weak var delegate: FUIPasscodeControllerDelegate!
-
The
FUIPrivateEncryptionKeyGenerator
for thisFUIPasscodeController
. A default implementation will be assigned. Developer could override this default implementation.Declaration
Swift
public weak var privateEncryptionKeyGenerator: FUIPrivateEncryptionKeyGenerator!
-
An UUID type string to identify the user. This will be used as part of the name to store passcode related items in the keychain.
For
FUIPasscodeInputController
, this property needs to match the same property in theFUIPasscodeCreateController
in order to retrieve the saved passcode from keychain.Declaration
Swift
public var userIdentifier: String?
-
The keychain access group associated with this instance. When set, the passcode related items will be stored in the shared keychain.
Declaration
Swift
public var keychainAccessGroup: String?
-
The source of passcode when
shouldTryPasscode
function ofFUIPasscodeControllerDelegate
is invoked. This value is initialized toFUIPasscodeSource.unknown
and will be set to the correct value, eitherFUIPasscodeSource.user
orFUIPasscodeSource.device
, just beforeshouldTryPasscode
is invoked.Declaration
Swift
public var passcodeSource: FUIPasscodeSource
-
The title for the choose passcode screen. The default is from localized strings file - “Choose Passcode”.
Declaration
Swift
public static var choosePasscodeTitleString: String?
-
The title for the confirm passcode screen. The default is from localized strings file - “Confirm Passcode”.
Declaration
Swift
public static var confirmPasscodeTitleString: String?
-
The title for the change passcode screens. The default is from localized strings file - “Change Passcode”.
Declaration
Swift
public static var changePasscodeTitleString: String?
-
The title for the enter passcode screen. The default is from localized strings file - “Passcode”.
Declaration
Swift
public static var passcodeTitleString: String?
-
The message on the confirm passcode screen for passcode setup. The default is from localized strings file - “Enter your passcode again.”.
Declaration
Swift
public static var enterPasscodeAgainString: String?
-
The message on the confirm passcode screen for passcode change. The default is from localized strings file - “Confirm your passcode.”.
Declaration
Swift
public static var confirmPasscodeString: String?
-
The message on the input passcode screen. The default is from localized strings file - “Enter your passcode”
Declaration
Swift
public static var enterYourPasscodeMessageString: String?
-
The message on the change passcode screen to ask user to enter current passcode. The default is from localized strings file - “Enter your current passcode”
Declaration
Swift
public static var enterYourCurrentPasscodeMessageString: String?
-
The button title string used in touch ID screen to indicate not to setup now.
Declaration
Swift
public static var notNowButtonString: String?
-
The button title string used on the second passcode setup to go back to the first screen.
Declaration
Swift
@available(*, deprecated, message: "This property is kept for backwards-compatibility, but has no effect on the view. The iOS default localized 'Back' string is used.") public static var backItemString: String?
-
The button title string used on the first passcode setup to go to the next screen.
Declaration
Swift
public static var nextItemString: String?
-
The button title string used on the confirm passcode screen or the login screen to finish the passcode setup.
Declaration
Swift
public static var doneItemString: String?
-
The main message format on the setup passcode screen. The %d will display the number of characters required from the passcode policy. The default format is from localized strings file - “Choose a passcode with at least %d characters for unlocking the app.”
Declaration
Swift
public static var setPasscodeMessageFormat: String?
-
The main message format on the setup passcode screen when the isDititsOnly property of the passcode policy is true. The %d will display the number of digits required from the passcode policy. The default format is from localized strings file - “Choose a passcode with at least %d digits for unlocking the app.”
Declaration
Swift
public static var setPasscodeWithDigitsMessageFormat: String?
-
The message for required character groups. The default is from localized strings file - “Include the following:”
Declaration
Swift
public static var includeRequiredGroupMessage: String?
-
The group name for lower case letters. The default string is from localized strings file - “Lower case (a-z)”
Declaration
Swift
public static var lowerCaseLabelString: String?
-
The group name for upper case letters. The default string is from localized strings file - “Upper case (A-Z)”
Declaration
Swift
public static var upperCaseLabelString: String?
-
The group name for digits. The default string is from localized strings file - “Digits (0-9)”
Declaration
Swift
public static var digitsLabelString: String?
-
The group name for non-alphabetic characters. The default string is from localized strings file - “Non-alphabetic (!@#…)”
Declaration
Swift
public static var nonAlphabeticLabelString: String?
-
The button title for resetting passcode. The default string is from localized strings file - “Reset Passcode”
Declaration
Swift
public static var resetPasscodeButtonString: String?
-
Alert message when validate method of
FUIPasscodeValidationDelegate
returning false for the passcode user entered in setup passcode. The default string is from localized strings file - “Passcode validation failed.”Declaration
Swift
public static var passcodeValidationFailedMessageString: String?
-
Alert message when the passcode user entered was rejected by the
FUIPasscodeControllerDelegate
‘s shouldTryPasscode function. The default string is from localized strings file - “Passcode was rejected by FUIPasscodeControllerDelegate.”Declaration
Swift
public static var passcodeRejectedMessageString: String?
-
Alert message when user tapped “Enable” on Touch ID screen. The default string is from localized strings file - “To use Touch ID, please add fingerprints in your device settings.”
Declaration
Swift
public static var useTouchIDMessageString: String?
-
Alert message when user tapped “Enable” on Face ID screen. The default string is from the localized strings file - “To use Face ID, please enroll Face ID in your device settings.”
Declaration
Swift
public static var useFaceIDMessageString: String?
-
Alert message when user tapped “Enable” on Optic ID screen.
The default string is from the localized strings file - “To use Optic ID, please enroll Optic ID in your device settings.”
Declaration
Swift
public static var useOpticIDMessageString: String?
-
The alert button title used on passcode validation failed, or passcode rejected. The default is from localized strings file - “Retry”
Declaration
Swift
public static var retryButtonString: String?
-
The title for setup touch ID screen. The default string is from localized strings file - “Touch ID”
Declaration
Swift
public static var touchIDTitleString: String?
-
The title for setup Face ID screen. The default string is from localized strings file - “Face ID”
Declaration
Swift
public static var faceIDTitleString: String?
-
The title for setting up the Optic ID screen.
The default string is from the localized strings file - “Optic ID”
Declaration
Swift
public static var opticIDTitleString: String?
-
The string that is to be used in the Touch ID or Face ID enablement screen when the Touch ID or Face ID becomes available. The default string is from localized string file - “ is now available!”. This is to be used combined with the
touchIDTitleString
orfaceIDTitleString
to form “Touch ID is now available!” or “Face ID is now available!”.Declaration
Swift
public static var isNowAvailableString: String?
-
The first paragraph of the message on the Touch ID screen when no fingerprints are enrolled on the device. The default string is from localized strings file - “Enabling Touch ID will give you faster access to your information.”
Declaration
Swift
public static var touchIDMessage1String: String?
-
The first paragraph of the message on the Face ID screen when no Face ID is enrolled on the device. The default string is from the localized strings file - “Enabling Face ID will give you faster access to your information.”
Declaration
Swift
public static var faceIDMessage1String: String?
-
The first paragraph of the message on the Optic ID screen when no Optic ID is enrolled on the device.
The default string is from localized strings file - “Enabling Optic ID will give you faster access to your information.”
Declaration
Swift
public static var opticIDMessage1String: String?
-
The first paragraph of the message on the Touch ID screen. when fingerprints are enrolled on the device. The default string is from localized strings file - “Please enable Touch ID for fast and secure access.”
Declaration
Swift
public static var touchIDEnableMessage1String: String?
-
The first paragraph of the message on the Face ID screen when Face ID is enrolled on the device. The default string is from localized strings file - “Please enable Face ID for fast and secure access.”
Declaration
Swift
public static var faceIDEnableMessage1String: String?
-
The first paragraph of the message on the Optic ID screen when Optic ID is enrolled on the device.
The default string is from the localized strings file - “Please enable Optic ID for fast and secure access.”
Declaration
Swift
public static var opticIDEnableMessage1String: String?
-
The second paragraph of the message on the Touch ID screen when fingerprints are not enrolled on the device. The default string is from localized strings file - “You can turn this feature On or Off anytime from Settings.”
Declaration
Swift
public static var touchIDMessage2String: String?
-
The second paragraph of the message on the Touch ID screen when Face ID is not enrolled on the device. The default string is from localized strings file - “You can turn this feature On or Off anytime from Settings.”
Declaration
Swift
public static var faceIDMessage2String: String?
-
The second paragraph of the message on the Touch ID screen when fingerprints are enrolled on the device. The default string is from localized strings file - “If Touch ID is deactivated, you will be asked for your device passcode.”
Declaration
Swift
public static var touchIDEnableMessage2String: String?
-
The second paragraph of the message on the Touch ID screen when Face ID is enrolled on the device. The default string is from localized strings file - “If Face ID is deactivated, you will be asked for your device passcode.”
Declaration
Swift
public static var faceIDEnableMessage2String: String?
-
The message for the link on the Touch ID screen. The default string is from localized strings file - “Learn more about Touch ID”
Declaration
Swift
public static var learnMoreTouchIDLinkString: String?
-
The message for the link on the Touch ID screen. The default string is from localized strings file - “Learn more about Face ID”
Declaration
Swift
public static var learnMoreFaceIDLinkString: String?
-
The message for the link on the Optic ID screen.
The default string is from the localized strings file - “Learn more about Optic ID.”
Declaration
Swift
public static var learnMoreOpticIDLinkString: String?
-
The button title to enable Touch ID or Face ID authentication. The default is from the localized strings file - “Enable.”
Declaration
Swift
public static var enableButtonString: String?
-
The message displayed when authenticate with Touch ID. The default string is from localized strings file - “Authenticate with Touch ID”
Declaration
Swift
public static var authenticateWithTouchIDMessageString: String?
-
The message displayed when authenticate with Face ID. The default string is from localized strings file - “Authenticate with Face ID”
Declaration
Swift
public static var authenticateWithFaceIDMessageString: String?
-
The message displayed when authenticating using Optic ID.
The default string is from localized strings file - “Authenticate with Optic ID.”
Declaration
Swift
public static var authenticateWithOpticIDMessageString: String?
-
The message when the passcode entered in confirm passcode screen does not match with the one entered in the setup passcode screen. The default string is from localized strings file - “Passcodes did not match. Try again.”
Declaration
Swift
public static var passcodeNotMatchMessageString: String?
-
The message format to be displayed when user entered wrong passcode and the remaining number of retries is greater than 1. The default format is from localized strings file - “You have %d attempts left”
Declaration
Swift
public static var attemptsLeftMessageFormat: String?
-
The message string to be displayed when user entered wrong passcode and there is only one remaining retry. The default string is from localized strings file - “You have 1 attempt left”
Declaration
Swift
public static var oneAttempLeftMessageFormat: String?
-
The first paragraph of the alert message when the number user entered wrong passcode reached maximum allowed. The default string is from localized strings file - “Maximum Passcode Attempts Reached”
Declaration
Swift
public static var maxAttemptsReachedMessageString: String?
-
The second paragraph of the alert message when the number user entered wrong passcode reached maximum allowed. The default string is from localized strings file - “Please enter your credentials to Sign in and reset the passcode”
Declaration
Swift
public static var enterCredentialsMessageString: String?
-
The text of the dismiss button on the alert. The default string is from localized strings file - “OK”
Declaration
Swift
public static var okButtonString: String?
-
The message on the passcode screen when user entered wrong passcode and there is no limit on the number of retries. The default string is from localized strings file - “Incorrect passcode. Try again.”
Declaration
Swift
public static var retryPasscodeMessageString: String?
-
The action title string used in setting up Touch ID alert to indicate not to go to Settings app. The default string is from localized strings file - “Not Now”
Declaration
Swift
public static var notNowActionString: String?
-
The action title string used in setting up Touch ID alert to indicate go to Settings app now. The default string is from localized strings file - “Settings”
Declaration
Swift
public static var settingsActionString: String?
-
The customized title string for Touch ID authentication fallback button.
See also
Declaration
Swift
public static var touchIDFallbackButtonTitle: String?
-
The customized title string for Touch ID/Face ID authentication cancel button.
See also
Declaration
Swift
public static var biometricIDCancelButtonTitle: String?
-
The customized background image to be applied to the pascode views.
The default is
nil
, no customized background image.Declaration
Swift
public static var backgroundImage: UIImage?
-
The
UIView.ContentMode
of theUIImageView
to be applied whenbackgroundImage
is specified.The default is
.scaleAspectFill
.Declaration
Swift
public static var backgroundImageContentMode: UIView.ContentMode
-
Allow content-driven resizing for all the buttons that support the feature in the screens. The default is false. Default to the size defined in Fiori Design Pattern
Declaration
Swift
@available(*, deprecated, message: "No longer supported.") public static var allowButtonsToUseIntrinsicContentSize: Bool
-
An image view to be added to the passcode screens.
This image view is to be displayed on the top center of passcode views and is typically the company logo image. Developer is expected to set the
image
property in order to display this image to the passcode views.- The image view will not be displayed if its
image
property is not set. - Developer can set the
imageViewSize
property to a specified size. Otherwise, the default size will be used whenimageViewSize
property isnil
.
Declaration
Swift
public internal(set) var imageView: UIImageView { get }
- The image view will not be displayed if its
-
The size of the image view.
If this property is
nil
, the default size of 256 px width and 54 px height is used. Note that the the maximum width is limited to 256 px and the maximum height is limited to 54 px.Declaration
Swift
public var imageViewSize: CGSize?
-
The flag indicating if the action button is on navigation bar or on the bottom of the passcode view.
The default value is
true
, which means the action button is on the navigation bar.Declaration
Swift
public var isActionButtonOnNavigationBar: Bool
-
The action button on the passcode view.
This button is to be shown only when
isActionButtonOnNavigationBar
isfalse
.Declaration
Swift
public internal(set) var actionButton: FUIButton { get }
-
Undocumented
Declaration
Swift
public func scrollViewDidScroll(_ scrollView: UIScrollView)
-
Checks to see if touchID is enabled
Declaration
Swift
@available(*, deprecated, message: "use isBiometricIDEnabled instead") public class func isTouchIDEnabled(userIdentifier: String? = nil, accessGroup: String? = nil) -> Bool
Parameters
userIdentifier
The user identifier string for the passcode.
accessGroup
The keychain access group string.
Return Value
true if touchID is enabled; otherwise, it’s disabled.
-
Checks to see if Biometric ID is enabled.
Declaration
Swift
public class func isBiometricIDEnabled(userIdentifier: String? = nil, accessGroup: String? = nil) -> Bool
Parameters
userIdentifier
The user identifier string for the passcode.
accessGroup
The keychain access group string.
Return Value
true if Biometric ID is enabled; otherwise, it’s disabled.
-
Check if the passcode hash was used in the current passcode.
Declaration
Swift
public class func isPasscodeHashUsed(userIdentifier: String? = nil, accessGroup: String? = nil) -> Bool
Parameters
userIdentifier
The user identifier string for the passcode.
accessGroup
The keychain access group string.
Return Value
True if the passcode hash was used. False, otherwise.
-
Use this function to enable using biometric ID on
FUIPasscodeInputController
.Declaration
Swift
public class func enableBiometricID(_ passcode: String, userIdentifier: String? = nil, accessGroup: String? = nil)
Parameters
passcode
The user passcode, or the hashed passcode if passcode hash was used.
userIdentifier
The user identifier string for the passcode.
accessGroup
The keychain access group string.
-
Clears touchID enabling entries created by the framework passcode controllers in the keychain.
Declaration
Swift
@available(*, deprecated, message: "use clearBiometricIDSettings instead") public class func clearTouchIDSettings(userIdentifier: String? = nil, accessGroup: String? = nil)
Parameters
userIdentifier
The user identifier string for the passcode.
accessGroup
The keychain access group string.
-
Clears biometric ID enabling entries created by the framework passcode controllers in the keychain.
Declaration
Swift
public class func clearBiometricIDSettings(userIdentifier: String? = nil, accessGroup: String? = nil)
Parameters
userIdentifier
The user identifier string for the passcode.
accessGroup
The keychain access group string.
-
Clears passcode-related, including biometric ID, entries created by the framework passcode controllers in the keychain.
Declaration
Swift
public class func clearPasscodeSettings(userIdentifier: String?, accessGroup: String? = nil)
Parameters
userIdentifier
The user identifier string for the passcode.
accessGroup
The keychain access group string.
-
This is the default implementation. It is generating an RSA private key with key length of 2048.
Declaration
Swift
public func generatePrivateEncryptionKey() -> Data
Return Value
The generated private encryption key.