Giter Club home page Giter Club logo

mbspasswordview's Introduction

Build Status Coverage Status Platform

MBSPasswordView is a custom view that provides an easy way to use a block-screen password.

Support

iOS 11.0+

Features

  • Pure Swift 4 ๐Ÿ”จ
  • Support 4 digits validation ๐Ÿ”’
  • TouchID and FaceID ๐Ÿคณ๐Ÿป
  • Light touch impact โ™’๏ธŽ
  • Shakable view ๐Ÿ’ฅ
  • Custom animation ๐Ÿ’ซ
  • Easy to use. ๐ŸคŸ๐Ÿป

Success Case

Invalid Case

Installation

CocoaPods

pod 'MBSPasswordView'

Carthage

MBSPasswordView is available through Carthage. To install it, simply add the following line to your Cartfile:

github "mayckonx/MBSPasswordView"

How to Use

  1. Import the framework
import MBSPasswordView
  1. Go to your Storyboard/XIB -> Identity Inspector and change your UIView class and module to:
MBSPasswordView
  1. Create an outlet and link it to your view as a MBSPasswordView.
@IBOutlet weak var passwordView: MBSPasswordView!
  1. Implement the protocol to get the password result.
extension ViewController: MBSPasswordDelegate {
     func password(_ result: [String]) { // optional
        print("Password:\(result)")
    }
    func passwordFromBiometrics(_ result: Result<[String]>) { // optional
        print("Result:\(result)")
    }
}
  1. Set the delegate in your viewDidLoad
  override func viewDidLoad() {
        super.viewDidLoad()
        
       passwordView?.delegate = self
       passwordView?.titleToRequestAuthentication = "Please, identify your self!"
       passwordView?.start(enableBiometrics: true)
    }

If you want, you can also check if the device supports FaceID/TouchID using:

passwordView?.isTouchIDAvailable()
passwordView?.isFaceIDAvailable()

That's it. If you enable biometrics, you get the password and automatically request the TouchID/FaceID every time. You just need to pass enableBiometrics: true on the start method. ๐Ÿ˜Ž It's done brah!

You can customize the view. In the sample you can see how to access the properties and change it to your preferences.

Next improvments

  1. Support 6 digits
  2. Different kind of animations

Suggestions or feedback?

Feel free to create a pull request, open an issue or find me on Twitter.

mbspasswordview's People

Contributors

mayckonx avatar

Watchers

James Cloos 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.