<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreLocationUI",
  "identifier" : "/documentation/CoreLocationUI/LocationButton/init(_:action:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "CoreLocationUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:021_CoreLocationUI_SwiftC00B6ButtonV_6actionA2C5TitleVSg_yyctcfc"
  },
  "title" : "init(_:action:)"
}
-->

# init(_:action:)

Creates a location button with the specified title and action.

```
nonisolated init(_ title: LocationButton.Title? = .currentLocation, action: @escaping () -> Void)
```

## Parameters

`title`

The text that the button displays. For possible values, see [`LocationButton.Title`](/documentation/CoreLocationUI/LocationButton/Title).

`action`

The action that initiates every time the user taps the button.

---

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)