How to do it...

  1. Create a new Xcode project with the Single View Application template and with name the TouchIDDemo.
  2. The demo app will be very simple; we will have a screen with only one button that will notify the authenticating user.
  3. Open Main.storyboard and change the layout of the screen to be as follows:
  1. Link an IBAction to the button in ViewController.swift to perform the logic of Touch ID authentication:
      @IBAction func didClickOnAuthenticate(_ sender: Any) { 
  1. Add the following import statement at the top of the source file:
      import LocalAuthentication 
  1. In the action function, first add the following code to check whether Touch ...

Get iOS Programming Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.