bkp

BKPasscodeView

iOS 7 style passcode view. Supports create, change and authenticate password.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

212

Maintenance

Last Commit

5yrs ago

Contributors

8

Package

Dependencies

1

License

MIT

Categories

Readme

BKPasscodeView

  • 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

Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot

Classes

ClassDescription
BKPasscodeFieldA custom control that conforms UIKeyInput. When it become first responder keyboard will be displayed to input passcode.
BKPasscodeInputViewA 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.
BKShiftingPasscodeInputViewA view that make a transition between two BKPasscodeInputView. You can shift passcode views forward and backward.
BKPasscodeViewControllerA view controller that supports create, change and authenticate passcode.
BKPasscodeLockScreenManagerA manager that shows lock screen when application entered background state. You can activate with activateWithDelegate: method.
BKTouchIDManagerA manager that save, load and delete keychain item. It saves passcode to keychain and item cannot be accessed without fingerprint.

Podfile

platform :ios
pod 'BKPasscodeView', '~> 0.1.2'

Example

Presenting Passcode View Controller

BKPasscodeViewController *viewController = [[BKPasscodeViewController alloc] initWithNibName:nil bundle: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];
[self presentViewController:navController animated:YES completion:nil];

Authenticate with Touch ID without presenting passcode view controller

BKPasscodeViewController *viewController = [[BKPasscodeViewController alloc] initWithNibName:nil bundle: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];
    [self presentViewController:navController animated:YES completion:nil];
  }
}];

Showing Lock Screen

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  // ...
  
  [[BKPasscodeLockScreenManager sharedManager] setDelegate:self];
  
  // ...
  return YES;
}

- (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
{
  return YES;   // return NO if you don't want to present lock screen.
}

- (UIViewController *)lockScreenManagerPasscodeViewController:(BKPasscodeLockScreenManager *)aManager
{
  BKPasscodeViewController *viewController = [[BKPasscodeViewController alloc] initWithNibName:nil bundle:nil];
  viewController.type = BKPasscodeViewControllerCheckPasscodeType;
  viewController.delegate = <# set delegate to authenticate passcode #>;
  
  UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
  return navController;
}

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100