You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
iOS7 style passcode view. Supports create, change and authenticate password.
Customizable lock policy for too many failure attempts.
Customizable passcode digit appearance.
Shows lock scrren when application entered background state. Use BKPasscodeLockScreenManager
You can authenticate passcode asynchronously. (e.g. using API to authenticate passcode)
Supports Touch ID API in iOS 8.
Screenshots
Classes
Class
Description
BKPasscodeField
A custom control that conforms UIKeyInput. When it become first responder keyboard will be displayed to input passcode.
BKPasscodeInputView
A view that supports numeric or normal(ASCII) passcode. This view can display title, message and error message. You can customize label appearances by overriding static methods.
BKShiftingPasscodeInputView
A view that make a transition between two BKPasscodeInputView. You can shift passcode views forward and backward.
BKPasscodeViewController
A view controller that supports create, change and authenticate passcode.
BKPasscodeLockScreenManager
A manager that shows lock screen when application entered background state. You can activate with activateWithDelegate: method.
BKTouchIDManager
A manager that save, load and delete keychain item. It saves passcode to keychain and item cannot be accessed without fingerprint.
Podfile
platform:iospod'BKPasscodeView','~> 0.1.2'
Example
Presenting Passcode View Controller
BKPasscodeViewController *viewController = [[BKPasscodeViewController alloc] initWithNibName:nilbundle:nil];
viewController.delegate = self;
viewController.type = BKPasscodeViewControllerNewPasscodeType;
// viewController.type = BKPasscodeViewControllerChangePasscodeType; // for change// viewController.type = BKPasscodeViewControllerCheckPasscodeType; // for authentication
viewController.passcodeStyle = BKPasscodeInputViewNumericPasscodeStyle;
// viewController.passcodeStyle = BKPasscodeInputViewNormalPasscodeStyle; // for ASCII style passcode.// To supports Touch ID feature, set BKTouchIDManager instance to view controller.// It only supports iOS 8 or greater.
viewController.touchIDManager = [[BKTouchIDManager alloc] initWithKeychainServiceName:@"<# your keychain service name #>"];
viewController.touchIDManager.promptText = @"Scan fingerprint to authenticate"; // You can set prompt text.
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
[selfpresentViewController:navController animated:YEScompletion:nil];
Authenticate with Touch ID without presenting passcode view controller
BKPasscodeViewController *viewController = [[BKPasscodeViewController alloc] initWithNibName:nilbundle:nil];
viewController.delegate = self;
viewController.type = BKPasscodeViewControllerCheckPasscodeType; // for authentication
viewController.passcodeStyle = BKPasscodeInputViewNumericPasscodeStyle;
// To supports Touch ID feature, set BKTouchIDManager instance to view controller.// It only supports iOS 8 or greater.
viewController.touchIDManager = [[BKTouchIDManager alloc] initWithKeychainServiceName:@"<# your keychain service name #>"];
viewController.touchIDManager.promptText = @"Scan fingerprint to authenticate"; // You can set prompt text.// Show Touch ID user interface
[viewController startTouchIDAuthenticationIfPossible:^(BOOL prompted) {
// If Touch ID is unavailable or disabled, present passcode view controller for manual input.if (NO == prompted) {
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
[selfpresentViewController:navController animated:YEScompletion:nil];
}
}];
Showing Lock Screen
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// ...
[[BKPasscodeLockScreenManager sharedManager] setDelegate:self];
// ...returnYES;
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// ...// show passcode view controller when enter background. Screen will be obscured from here.
[[BKPasscodeLockScreenManager sharedManager] showLockScreen:NO];
}
- (BOOL)lockScreenManagerShouldShowLockScreen:(BKPasscodeLockScreenManager *)aManager
{
returnYES; // return NO if you don't want to present lock screen.
}
- (UIViewController *)lockScreenManagerPasscodeViewController:(BKPasscodeLockScreenManager *)aManager
{
BKPasscodeViewController *viewController = [[BKPasscodeViewController alloc] initWithNibName:nilbundle:nil];
viewController.type = BKPasscodeViewControllerCheckPasscodeType;
viewController.delegate = <# set delegate to authenticate passcode #>;
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
return navController;
}