Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mnaruse/70cebb1d0e6b576b0dc29ffca685c6c4 to your computer and use it in GitHub Desktop.
Save mnaruse/70cebb1d0e6b576b0dc29ffca685c6c4 to your computer and use it in GitHub Desktop.
WWDC20: What's new in location.
// iOS14
// 新しいデリゲート・コールバック・メソッドを実装する方法を以下に示します。
// どのように進めるかを決定するには、authorizationStatus と accuracyAuthorization の両方の値を確認する必要があります。
func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
switch manager.authorizationStatus {
case .authorizedAlways, .authorizedWhenInUse:
self.hasSomeKindOfPermission = true
case .notDetermined, .denied, .restricted:
self.hasSomeKindOfPermission = false
default:
print("Unhandled case")
}
switch manager.accuracyAuthorization {
case .reducedAccuracy:
self.gettingExactLocation = false
case .fullAccuracy:
self.gettingExactLocation = true
default:
print("This shouldn't happen!")
}
}
@mnaruse
Copy link
Author

mnaruse commented Jul 8, 2020

first commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment