---
title: "init(_:intent:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/button/init(_:intent:)-7urde"
---

# init(_:intent:)

Creates a button that performs an AppIntent and generates its label from a localized string key.

## Declaration

```swift
nonisolated init(_ titleKey: LocalizedStringKey, intent: some AppIntent)
```

## Parameters

- `titleKey`: The key for the button’s localized title, that describes the purpose of the button’s intent.
- `intent`: The AppIntent to execute.

## Discussion

Discussion This initializer creates a Text view on your behalf, and treats the localized key similar to init(_:tableName:bundle:comment:). See Text for more information about localizing strings. To initialize a button with a string variable, use init(_:intent:) instead.
