<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Button/init(_:intent:)-7urde",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI6ButtonV012_AppIntents_aB0AA4TextVRszrlE_6intentACyAFGAA18LocalizedStringKeyV_qd__tc0dE00D6IntentRd__lufc"
  },
  "title" : "init(_:intent:)"
}
-->

# init(_:intent:)

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

```
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

This initializer creates a `Text` view on your behalf, and treats the
localized key similar to `Text/init(_:tableName:bundle:comment:)`.
See `Text` for more information about localizing strings.

To initialize a button with a string variable, use
`Button/init(_:intent:)` instead.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)