Meet the Location Button

Description: Meet CLLocationButton: a secure interface element that provides an easy, low-friction way to grant your app location access only when and where it is needed. Learn how you can add CLLocationButton to new or existing code, how to customize it within interface legibility guidelines, how to recognize and address customization failures, and how it interacts with iOS’s traditional prompt-based Location Services authorization. To get the most out of this session, we recommend basic familiarity with the Core Location API.

  • these buttons give your app Allow-Once authorization, without prompting user authorization every time it's tapped
  • available on watchOS, iOS, macOS with Catalyst, and iPad apps on Mac


(UIKit) CLLocationButton

This is a UIButton with customizable parameters:

  • CLLocationButtonIcon to set the type of the arrow
  • CLLocationLabel to set the label of the button
  • cornerRadius to set the roundness of the button
  • fontSize to set the size of the label

(SwiftUI) LocationButton

LocationButton(.currentLocation) { 
  // do something on button press...


Note that not all customization are possible, Xcode will warn you with log messages when the minimum requirements are not met, for example:

#locationButton rendering failed due to inappropriate sizes 
#locationButton rendering failed due to Insufficient Alpha
#locationButton rendering failed due to contrastRatio between tintColor and backgroundColor insufficient 


  • If your app already have any kind of location authorization, then the button will work right away
  • If your app doesn't have any permission yet, tapping the location button will trigger a one-time prompt (which won't be shown again when tapped again), see below
  • this same prompt is shown if the user previously denied your app location permission access

Missing anything? Corrections? Contributions are welcome 😃


Written by

Federico Zanetello

Federico Zanetello

iOS Engineer with strong passion for Swift, minimalism, and design. When he’s not busy automating things, he can be found writing at FIVE STARS and/or playing with the latest shiny toys.