From the course: Biometric Authentication for iOS in Swift
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Evaluation policy check
From the course: Biometric Authentication for iOS in Swift
Evaluation policy check
- [Instructor] So now that we have our context all created and configured, let's use it to determine if the user can evaluate biometric policies. So after line 22, I'm going to add a couple a blank lines, and on line 24 I'm going to create a new function. So I'll type func evaluatePolicy open close paren with no parameters, open close curly braces and after line 21, I'm going to actually call this function, so I'll type on line 22 evaluatePolicy open close paren. And in the body of our function on line 26, I first need to create a variable to house the error if one occurs, so I'll type var errorCanEval: and I'll make it of type NSError?, so an optional. This is what we're going to pass in, and it'll be set to the error if one occurs. Then on line 27, I'm going to check to see if this device can evaluate the policy. It checks to see if the device is capable, if the user's enrolled, if it's still enabled and not locked out, and so forth. So I'll type if context canEvaluatePolicy and the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.