Book Image

Application Development with Swift

By : Hossam Ghareeb
Book Image

Application Development with Swift

By: Hossam Ghareeb

Overview of this book

Table of Contents (14 chapters)

The LocalAuthentication framework


To start using Touch ID in your app, you have to use a new framework named LocalAuthentication. This framework provides everything you need to add Touch ID authentication in to your app. The framework is responsible for displaying the touch prompt to a user to provide his fingerprint for scanning to perform authentication. Some users may refuse to use it. If the authentication failed for any reason, in that case, you have to provide your own way for authentication like the old ways via e-mail or something else. Now, I will show you how to use the LocalAuthentication framework to prompt the user to authenticate himself.

The final result of our demo will be as follows:

The first step is to create a new iOS project with a single-view template and make sure that you select Swift as your development language. Then add LocalAuthentication framework, as follows:

Now that your project is configured to use Touch ID, open ViewController.swift and let's add a method...