Very simple swift wrapper for Biometric Authentication Services (Touch ID) on iOS.
There is a SimpleTouchDemo target defined in the project file. This will run in
the Simulator or on a device.
Add the following to your Cartfile
github "simple-machines/simple-touch"
- Drag and drop
SimpleTouch.xcodeprojinto your project in Xcode. - Add the SimpleTouch framework
SimpleTouch (SimpleTouch)as aTarget DependencyinBuild Phasesin your project. - Add
SimpleTouch.frameworkin theLink Binary With Librariesstep inBuild Phasesin your project if it's not there already.
First of all, import the framework:
import SimpleTouch
Then, check for Touch ID support:
switch SimpleTouch.isTouchIDEnabled {
case .success:
// All is good. Can use Touch ID for authentication
break
case .error(let error):
// TouchID cannot be used. Interrogate error to see why
break
}
Finally, attempt to authenticate with Touch ID:
SimpleTouch.presentTouchID("Testing Touch ID", fallbackTitle: "Fallback Method") { response in
switch response {
case .success:
// Successful authentication
break
case .error(let error):
// Authentication failed. Interrogate error to see why
break
}
}
We ❤️ pull requests. If you'd like to see new features, fix bugs, or lodge issues then please do so via Github.
SimpleTouch is released under an MIT license. See LICENSE.md for more information.