GateKeeper 0.2.2

GateKeeper 0.2.2

Manish Ahuja 维护。



  • Manish Ahuja

Gatekeeper

Gatekeeper 允许您通过一行代码在您的应用中添加 TouchId/FaceId 身份验证。一旦配置,您的应用将提示用户使用 TouchId/FaceId 进行身份验证(如果设备上可用并已启用),然后再允许用户访问应用。

安装

Cocoapods

要使用 CocoaPods 将 GateKeeper 集成到您的 Xcode 项目中,在 Podfile 中指定它

Swift 4.0

  pod 'GateKeeper', :git => 'https://github.com/ahujamanish/GateKeeper.git'

示例

只需在应用的 AppDelegate 中添加以下行

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
...    
		window?.makeKeyAndVisible()
		GateKeeper.shared.configure(enabled: true)
...
		return true
}

同时,请确保在项目的 Info.plist 中添加以下条目,以提供 Face Id 的使用说明

		<key>NSFaceIDUsageDescription</key>
		<string>Allow <Your App Name> access to Face Id for Authentication</string>

您可以通过以下方式在任何时候启用/禁用身份验证:

...
		GateKeeper.shared.enabled = true
...

许可证

GateKeeper可在MIT许可证下使用。有关更多信息,请参阅LICENSE文件。