---
title: LocalAuthenticationView
framework: localauthentication
role: symbol
role_heading: Structure
path: localauthentication/localauthenticationview
---

# LocalAuthenticationView

A SwiftUI view that displays an authentication interface.

## Declaration

```swift
@MainActor @preconcurrency struct LocalAuthenticationView<Label> where Label : View
```

## Overview

Overview Use a LocalAuthenticationView to display a view that prompts users to authenticate with the app. The view visually represents the state of an LAPolicy evaluation from the Local Authentication framework. The following shows a LocalAuthenticationView in a Mac app with an implicit LAContext instance: var body: some View {     LocalAuthenticationView(         "Continue with Touch ID",         reason: Text("Access sandcastle competition designs")     ) { result in         switch result {         case .success:             print("Authorized")         case .failure(let error):             print("Authorization failed: \(error)")         }     }     .controlSize(.large) } If your app’s authorization flow reuses an existing LAContext, pass it as part of initializing a LocalAuthenticationView and call its evaluatePolicy(_:localizedReason:reply:) method after the view appears.

## Topics

### Authenticating with an implicit context

- [init(reason:context:result:label:)](localauthentication/localauthenticationview/init(reason:context:result:label:).md)
- [init(_:reason:context:result:)](localauthentication/localauthenticationview/init(_:reason:context:result:)-8ubaq.md)
- [init(_:reason:context:result:)](localauthentication/localauthenticationview/init(_:reason:context:result:)-917ds.md)
- [init(_:reason:context:result:)](localauthentication/localauthenticationview/init(_:reason:context:result:)-4pkpi.md)

### Authenticating with a context you supply

- [init(_:context:)](localauthentication/localauthenticationview/init(_:context:)-9xeoo.md)
- [init(context:label:)](localauthentication/localauthenticationview/init(context:label:).md)
- [init(_:context:)](localauthentication/localauthenticationview/init(_:context:)-676qx.md)

### Initializers

- [init(_:context:)](localauthentication/localauthenticationview/init(_:context:)-7ejbu.md)
- [init(_:reason:context:result:)](localauthentication/localauthenticationview/init(_:reason:context:result:)-88u6u.md)

## Relationships

### Conforms To

- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [View](swiftui/view.md)
