An LAContext object represents an authentication context. The LAContext class provides a programmatic interface for evaluating authentication policies and access controls, managing credentials, and invalidating authentication contexts.


Authentication contexts are used to evaluate authentication policies, allowing apps to request the user to authenticate themselves using personal information such as a fingerprint registered with Touch ID.


Evaluating Authentication Policies

func canEvaluatePolicy(LAPolicy, error: NSErrorPointer)

Preflights an authentication policy to see if it is possible for authentication to succeed.

var evaluatedPolicyDomainState: Data?

The current state of the evaluated policy domain.

Managing Credentials

func setCredential(Data?, type: LACredentialType)

Sets an application-provided credential to be used when evaluating authentication.

func isCredentialSet(LACredentialType)

Returns whether the specified credential type is set.

var touchIDAuthenticationAllowableReuseDuration: TimeInterval

The duration for which Touch ID authentication reuse is allowable.

var localizedFallbackTitle: String?

The localized title for the fallback button in the dialog presented to the user during authentication.

var localizedCancelTitle: String?

The localized title for the fallback button in the dialog presented to the user during authentication.

Invalidating the Authentication Context

func invalidate()

Invalidates the authentication context.


Local Authentication Error Domain

The error domain for the Local Authentication framework.

enum LAError.Code

Error codes that can be returned when evaluating a policy.

enum LAPolicy

Policies specifying which forms of authentication are acceptable.

enum LACredentialType

Types of credentials to be used for authentication.

enum LAAccessControlOperation

Operations to be evaluated for access control by the evaluateAccessControl(_:operation:localizedReason:reply:) method.

Touch ID Authentication Reuse

Durations for Touch ID authentication reuse, used by the touchIDAuthenticationAllowableReuseDuration property.


Inherits From

Conforms To

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software