<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreLocationUI",
  "identifier" : "/documentation/CoreLocationUI/CLLocationButton",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "CoreLocationUI"
    ],
    "preciseIdentifier" : "c:objc(cs)CLLocationButton"
  },
  "title" : "CLLocationButton"
}
-->

# CLLocationButton

A button that grants one-time location authorization.

```
class CLLocationButton
```

## Overview

`CLLocationButton` simplifies requesting one-time authorization to access
location data. Add this button to your user interface in situations when
users may want to grant temporary access to their location data each time
they use a particular feature of your app.

![Screenshot of the location button with an icon that uses the filled arrow](images/com.apple.CoreLocationUI/cllocationbutton-1@2x.png)

The first time a user taps this button,
<doc://com.apple.documentation/documentation/CoreLocation> asks the user to
confirm that they’re comfortable using this UI element when they want to
grant temporary access to their location data. If the user agrees, the app
receives temporary
<doc://com.apple.documentation/documentation/CoreLocation/CLAuthorizationStatus/authorizedWhenInUse>
authorization, like when the user chooses *Allow Once* in response to your
app’s standard location authorization request. This temporary authorization
expires when your app is no longer in use.

After the user agrees to using `CLLocationButton`, the button becomes
approved to request future authorizations without displaying an additional
alert to the user. The next time the user taps it, this button simply grants
one-time authorization without requiring confirmation.

After you receive this temporary authorization, fetch the user’s location
using the <doc://com.apple.documentation/documentation/CoreLocation> API and
perform any app-specific tasks related to that location data. Connect the
button to initiate the tasks you want to perform after getting authorization
by adding a target and action to the button. Keep in mind that this action
activates every time the user taps this button, regardless of whether the
app already has location authorization.

Create a `CLLocationButton` in Interface Builder or in code, like this:

```swift
let locationButton = CLLocationButton()
locationButton.icon = .arrowFilled
locationButton.label = .currentLocation
locationButton.cornerRadius = 25.0
locationButton.addTarget(self, action: #selector(userPressedLocationButton), for: .touchUpInside)
```

> Important: When a user taps the button, it only provides one-time
> authorization to fetch location data — not the location data itself. For
> more details about fetching location data, see
> <doc://com.apple.documentation/documentation/CoreLocation/configuring-your-app-to-use-location-services>.

Configure the button’s content by specifying its [`icon`](/documentation/CoreLocationUI/CLLocationButton/icon)
and [`label`](/documentation/CoreLocationUI/CLLocationButton/label) styles. Customize its appearance using the
[`cornerRadius`](/documentation/CoreLocationUI/CLLocationButton/cornerRadius) and [`fontSize`](/documentation/CoreLocationUI/CLLocationButton/fontSize)
properties, or the standard view appearance properties
<doc://com.apple.documentation/documentation/UIKit/UIView/backgroundColor>
and
<doc://com.apple.documentation/documentation/UIKit/UIView/tintColor>.
For design guidance, see 
[Human Interface
Guidelines](https://developer.apple.com/design/human-interface-guidelines/ios/app-architecture/accessing-user-data/).

## Topics

### Customizing the icon style

[`icon`](/documentation/CoreLocationUI/CLLocationButton/icon)

The style of the location arrow icon on the button.

### Customizing the label text

[`label`](/documentation/CoreLocationUI/CLLocationButton/label)

The text of the button label.

### Customizing the button appearance

[`cornerRadius`](/documentation/CoreLocationUI/CLLocationButton/cornerRadius)

The corner radius of the button.

[`fontSize`](/documentation/CoreLocationUI/CLLocationButton/fontSize)

The font size of the text on 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)