Giter Club home page Giter Club logo

appspasscode's Introduction

APPSPasscode

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).

appspasscode's People

Contributors

appstronomy avatar idstar avatar kgrigsby59 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.