Git Product home page Git Product logo

pinentryview's Introduction

PinEntryView Logo

Swift3.1 Platform Version License

Description

PinEntryView is a customizable view written in Swift that can be used to confirm alphanumeric pins. Use cases include typing ACCEPT after reviewing Terms of Service and setting or confirming a passcode.

screen shot 2017-04-27 at 5 01 21 pm

Contents

  1. Features
  2. Installation
  3. Supported OS & SDK versions
  4. Usage
  5. License
  6. Contact

Features

  • Supports AutoLayout and has intrinsic size. Optionally set a height to make the boxes taller or a width to add more inner spacing between boxes.
  • Fully configurable in Interface Builder (supports @IBDesignable and @IBInspectable) and code.
  • Customizable for many different use cases.
  • Example app to demonstrate the various configurations.

Example Project Screenshot

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:

$ gem install cocoapods

To integrate PinEntryView into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'PinEntryView'

Then, run the following command:

$ pod install

In case Xcode complains ("Cannot load underlying module for PinEntryView") go to Product and choose Clean (or simply press โ‡งโŒ˜K).

Manually

If you prefer not to use CocoaPods, you can integrate PinEntryView into your project manually.

  • Supported build target - iOS 8.0+ (Xcode 8.3.2+)

PinEntryView is state based. To configure the view, simply update the state value with whatever values you'd like, and re-set the state:

  1. First you should set up the PinEntryView and provide an initial state:
var pinEntryView = PinEntryView()
pinEntryView.state = PinEntryView.State(pin: "ACCEPT",
                                        allowsBackspace: true,
                                        showsPlaceholder: true,
                                        placeholderTextColor: .lightGray,
                                        allowsAllCharacters: false,
                                        focusBorderColor: .black,
                                        inactiveBorderColor: .lightGray,
                                        completedBorderColor: .green,
                                        errorBorderColor: .red,
                                        returnKeyType: .done)
  1. Once set, you can optionally adjust individual parameters in the state:

Reassigning one var can be done in line:

pinEntryView.state?.returnKeyType = .next

or

Group up reassigning multiple vars that way only one update (PinEntryView.update()) cycle is made:

var state = pinEntryView.state
state?.completedBorderColor = .clear
state?.showsPlaceholder = false
pinEntryView.state = state

PinEntryView is developed by Jeff Burt at StockX and is released under the MIT license. See the LICENSE file for details.

Feel free to follow me on my personal Twitter account. If you find any problems with the project or have ideas to enhance it, feel free to open a GitHub issue and/or create a pull request.

pinentryview's People

Contributors

jeffaburt avatar jrmsklar 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.