Latest 0.1.1
Homepage https://github.com/appstronomy/APPSPasscode
License MIT
Platforms ios 9.3, requires ARC
Frameworks UIKit

Carthage compatible
BuddyBuild

Introduction

A reusable passcode subsystem for iOS apps. This is used as a passcode foundation by Appstronomy for our own internal and client projects. We wanted to share our solution to a common need.

Originally built in Objective-C, this framework will also work well in your Swift based apps, as demonstrated by our example Swift app bundled with this repo. The example app shows you how you might use the APPSPasscode framework, including how to customize it.

Demo Gallery

The following animation takes you through the capabilities of the Example app bundled inside this repo. Here, you’ll see the default and custom visual styles.

Example App Demo

On the iPad, the component still uses iPhone sized controls, centered on the iPad screen. Here’s an example of that from the PK-PD Compass app for clinicians. It’s also another example of the custom styling that’s possible.

PKPD Compass App on iPad

Default and Custom Styles

You can change the visual appearance of the passcode (lines, colors, images) as suits the needs of your app. While the default style mimics Apple’s own native iOS passcode control, we don’t recommend you ship using that default style. It’s only an example to provide you with a familiar starting point.

We learned the hard way that your app can be rejected for presenting a passcode control that is too close to Apple’s own.

Consequently, we built a generic way to style the passcode component. This way, it can take on the look of the host app it is serving. And passing App Review is also a worthy goal! :)

In the Example app in this repo, you’ll see the default style and a custom style.

Configuring Styles

To configure a visual style to your liking, you’ll create an instance of APPSPasscodeViewConfiguration and set this to be the viewConfiguration on the APPSPasscodeViewController.

Here’s an example from the bundled Example app, in Swift. It is taken from the DemoPasscodeService.swift:

        var configuration: APPSPasscodeViewConfiguration?

        if passcodeStyle == .Custom {
            configuration = APPSPasscodeViewConfiguration()
            configuration!.topToLogoSpacing = 30
            configuration!.logoToInstructionLabelSpacing = 30

            configuration!.rootViewBackgroundColor = UIColor.lightGrayColor()
            configuration!.messageContainerBackgroundColor = UIColor.lightGrayColor()
            configuration!.keypadBackgroundColor = UIColor.lightGrayColor()

            configuration!.keypadBackgroundColor = UIColor.grayColor()
            configuration!.keypadNumericKeyDefaultColor = UIColor.grayColor()
            configuration!.keypadNumericKeyHighlightColor = UIColor.darkGrayColor()
            configuration!.keypadTextColor = UIColor.whiteColor()
            configuration!.bulletColor = UIColor.darkGrayColor()
        }

        let passcodeController = APPSPasscodeViewController()
        passcodeController.viewConfiguration = configuration

Installation and Usage

For Your App

The easiest way to use APPSPasscode in your app is to add it as a Carthage dependency.

Add the following entry to your app project’s Cartfile:

github "appstronomy/APPSPasscode"

Xcode: Workspace and Project Files

If you open up the APPSPasscode.xcodeproj project file, you’ll see just the APPSPasscode framework.

If instead, you open up the APPSPasscode.xcworkspace workspace file, you’ll see the APPSPasscode framework and an Example app that demonstrates how you might use it.

Dependencies

The APPSPasscode framework has an embedded dependency on the Lockbox utility class. As such, you do not have to worry about carthage or cocoapod dependencies of this framework when you pull it into your projects.

That said, you can ignore that default dependency and choose to use another tool or mechanism to store a user’s passcode.

Credits

The original passcode subsystem was built for Appstronomy by Chris Morris in 2014.

Later enhancements were made by Ken Grigsby and Sohail Ahmed. UI/UX guidance was provided by Salman Sajid throughout integration in client projects (snazzier styling that unfortunately, we cannot bundle for you in this repo).

Latest podspec

{
    "name": "APPSPasscode",
    "version": "0.1.1",
    "summary": "A reusable passcode subsystem for iOS apps.",
    "description": "A reusable passcode subsystem for iOS apps. This is used as a passcode foundation by Appstronomy for our own internal and client projects. We wanted to share our solution to a common need.nnOriginally built in Objective-C, this framework will also work well in your Swift based apps, as demonstrated by our example Swift app bundled with this repo. The example app shows you how you might use the APPSPasscode framework, including how to customize it.",
    "homepage": "https://github.com/appstronomy/APPSPasscode",
    "license": {
        "type": "MIT"
    },
    "authors": "Sohail Ahmed, Chris Morris, Ken Grigsby",
    "social_media_url": "http://twitter.com/appstronomy",
    "platforms": {
        "ios": "9.3"
    },
    "requires_arc": true,
    "frameworks": "UIKit",
    "source": {
        "git": "https://github.com/appstronomy/APPSPasscode.git",
        "tag": "0.1.1"
    },
    "source_files": "APPSPasscode/**/*.[hm]",
    "public_header_files": [
        "APPSPasscode/APPSPasscodeCredentialsManager.h",
        "APPSPasscode/APPSPasscodeService.h",
        "APPSPasscode/APPSPasscodeViewConfiguration.h",
        "APPSPasscode/APPSFormSheetTransition.h",
        "APPSPasscode/APPSPasscodePresenter.h",
        "APPSPasscode/APPSPasscodeViewController.h",
        "APPSPasscode/APPSPasscodeViewControllerDelegate.h",
        "APPSPasscode/APPSPasscodeUsername.h",
        "APPSPasscode/APPSPasscodeEnums.h",
        "APPSPasscode/APPSPasscode.h"
    ],
    "resources": "APPSPasscode/Resources/*"
}

Pin It on Pinterest

Share This