In my app I have a tab called \"Discover\". The Discover tab will use the users current location to find \"stuff\" near them. Instead of presenting the user with a generic Autho
Similar to tdon's response above, I created a function with a completion block to communicate the status once it is retrieved from the device:
func retrieveAuthorizationStatus(completion: @escaping (TrackingState) -> ()) {
let status = CLLocationManager.authorizationStatus()
switch status {
case .authorizedWhenInUse:
completion(.off)
default:
completion(.issue)
}
}
TrackingState is a separate enum I'm using to manage display within a view controller. You could just as easily pass the authorizationStatus() in the completion block:
func retrieveAuthorizationStatus(completion: @escaping (CLAuthorizationStatus) -> ()) {
let status = CLLocationManager.authorizationStatus()
completion(status)
}