Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

Latest commit

 

History

History
56 lines (41 loc) · 1.87 KB

10102.md

File metadata and controls

56 lines (41 loc) · 1.87 KB
contributors
zntfdr
  • New quick authorization button:

  • 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

Customization

(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...
}
.foregroundColor(.white)
.cornerRadius(15.0)
.labelStyle(.titleAndIcon)
.symbolVariant(.fill)
.tint(.blue)

Warning

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 

Prompt

  • 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