Latest 1.0.6
Homepage https://github.com/hackjie/GPassword
License MIT
Platforms ios 8.0
Authors

GPassword




中文版本请看这里

Simple gesture password in swift

Features

  • Use delegate for gesture view to pass password
  • Use CAShapeLayer、UIBezeierPath to draw for good performance
  • Support define 3*34*4… Matrix
  • Support define many kinds of normal and selected style
  • Use KeyChain and UserDefaults to save informations

Screenshots

Requirements

  • iOS 8.0+
  • Xcode 9.0+
  • Swift 4.0+

Install

CocoaPods

pod "GPassword"

or you can drag Source folder into your project.

Usage

First custom UI style, here is what you need:

GPassword.config { (options) in
    options.connectLineStart = .border
    options.normalstyle = .innerFill
    options.isDrawTriangle = true
    options.matrixNum = 3
}

then you can use Box.swift or add it to a UIViewController

fileprivate lazy var passwordBox: Box = {
    let box = Box(frame: CGRect(x: 50, y: 200, width: GWidth - 2 * 50, height: 400))
    box.delegate = self
    return box
}()

then you need to achieve two delegate methods, you should write business logics in them, sendTouchPoint can send out complete password and touchesEnded can deal business logics according to type(setting/verify/modify)

extension PasswordViewController: EventDelegate {
    func sendTouchPoint(with tag: String) {
        password += tag
        // get complete password
    }

    func touchesEnded() {
        // write business logics according to type
    }
}

more informations you can see PasswordViewController.swift in demo project, I write an example.

License

GPassword is released under the MIT license. See LICENSE for details

Latest podspec

{
    "name": "GPassword",
    "version": "1.0.6",
    "summary": "Simple gesture password in swift.",
    "description": "This framework help you build your gesture password easily!",
    "homepage": "https://github.com/hackjie/GPassword",
    "license": "MIT",
    "authors": {
        "leoli": "[email protected]"
    },
    "source": {
        "git": "https://github.com/hackjie/GPassword.git",
        "tag": "1.0.6"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Source/**/*.swift"
}

Pin It on Pinterest

Share This