Latest2.0.3
Homepagehttps://github.com/BeckWang0912/GesturePasswordKit
LicenseMIT
Platformsios 8.0, requires ARC
DependenciesKingfisher
Authors

CocoaPods
Platforms
License

GesturePasswordKit

GesturePasswordKit是一套手势密码管理与指纹解锁工具

Install Required

  • iOS 8.0+
  • Xcode 9.0+
  • Swift 4.0

Install

  • pod "GesturePasswordKit"

Swift项目中使用

1.个性化配置

    /// LockManager 手势密码可配置集合(未配置的按照初始化的默认值)
    ///
    /// - Parameters:
    ///   - keySuffix: key后缀,非空
    ///   - inColor: 绘制时内圈和连线颜色, 非空
    ///   - outColor: 绘制时外圈选中色,非空
    ///   - imageUrl: 用户URL图像,可为空,为空时取defaultImage
    ///   - defaultImage: 外传imgae,可为空,为空时取本库默认image:login_user_default
    ///   - navTitle: 导航栏标题颜色,可为空,默认为黑色
    ///   - barTintColor: barButton文字颜色
    ///   - barTittleColor: 导航栏标题颜色,可为空,默认为黑色
    ///   - warningColor:  警告文字颜色,可为空,默认为红色
    func configLockManager(passwordKeySuffix keySuffix: String,
                           inCircleSelectedColor inColor: UIColor,
                           outCircleSelectedColor outColor: UIColor,
                           imageUrl: String? = nil,
                           defaultImage: UIImage? = nil,
                           navTitle: String? = nil,
                           barTintColor: UIColor? = nil,
                           barTittleColor: UIColor? = nil,
                           warningColor: UIColor? = nil) {

                             // do something

                           }

2.设置手势密码

    // 设置手势密码
    func settingLockGestrue(fromViewController: UIViewController, completeHandle:@escaping (() -> Void))

    // 设置手势密码闭包回调
    var settingGesturePwdClosure: ((_ viewCtrl: UIViewController) -> Void)?

3.修改手势密码

    // 修改手势密码
    func modifyLockController(fromViewController: UIViewController,completeHandle:@escaping (() -> Void))

4.验证手势密码

    // 验证手势密码
    func vertifyHandGesturePassword(viewController: UIViewController) 

5.打开手势

    // 打开手势
    func openHandGesture(fromViewController: UIViewController, completeHandle:@escaping ((_ isOpen:Bool) -> Void))

6.关闭手势

    // 关闭手势
    func closeHandGesture(fromViewController: UIViewController, completeHandle:@escaping ((_ isOpen:Bool) -> Void)) 

7.注册手势密码

    //  注册成功后调用
    //  主要是存储当前用户的手势 (key 为 token)
    //  注意: 注册流程是手势设置成功后才注册,这里会从默认手势密码那里来获取设置的手势值重新设置到对应的用户.
    func setupHandGestureWhenRegister() {
        LockManager.options.passwordKeySuffix = "用户自定义唯一后缀"
        var password = LockManager.storage.str(forKey: PASSWORD_KEY + LockManager.options.passwordKeySuffix)
        if password == nil || password?.characters.count == 0 {
            password = LockManager.storage.str(forKey: PASSWORD_KEY) ?? ""
            LockManager.storage.setStr(password!, key: PASSWORD_KEY + LockManager.options.passwordKeySuffix)
        }
        LockManager.openGesture()
    }

8.销毁手势密码

    // 注销用户调用
    // 主要是删除当前用户手势 (key 为 token)
    // 这里不做处理 不需要删除用户手势
    func removeHandGestureWhenLogout() {
        LockManager.options.passwordKeySuffix = "用户自定义唯一后缀"
        LockManager.storage.removeValue(forKey: PASSWORD_KEY + LockManager.options.passwordKeySuffix)
        LockManager.storage.removeValue(forKey: OPEN_KEY + LockManager.options.passwordKeySuffix)
    }

9.打开手势密码绘制轨迹

    /// 打开手势轨迹
    func openHandGestureTrack(fromViewController: UIViewController, completeHandle:@escaping ((_ isOpen:Bool) -> Void)) {}

10.关闭手势密码绘制轨迹

   func closeHandGestureTrack(fromViewController: UIViewController, completeHandle:@escaping ((_ isOpen:Bool) -> Void)) {}

11.指纹解锁

  • 代码很简单,一个文件TouchIDSwift,使用时直接调用showTouchID(desc:completionHandler:),如下:
   func showTouchID(desc: String, completionHandler: @escaping (NSError?, TouchIDState?) -> Void) {}

图示

image

parameters

更多可配置参数请见代码,可自由放开或封闭

License

This code is distributed under the terms and conditions of the MIT license.

Latest podspec

{
    "name": "GesturePasswordKit",
    "version": "2.0.3",
    "summary": "u624bu52bfu5bc6u7801",
    "homepage": "https://github.com/BeckWang0912/GesturePasswordKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "description": "GesturePasswordKit `GesturePasswordKit` u662fu4e00u5957u624bu52bfu5bc6u7801u7ba1u7406u4e0eu6307u7eb9u89e3u9501u5de5u5177",
    "authors": {
        "IMAC-AF9B8D": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/BeckWang0912/GesturePasswordKit.git",
        "tag": "v2.0.3"
    },
    "resources": "GesturePasswordKit/Resource.bundle",
    "source_files": [
        "GesturePasswordKit/GesturePassword/**/*",
        "GesturePasswordKit/TouchLock/**/*"
    ],
    "requires_arc": true,
    "dependencies": {
        "Kingfisher": [
            "~> 4.7.0"
        ]
    }
}

Pin It on Pinterest

Share This