Skip to content

Instantly share code, notes, and snippets.

@farhadmpr
Created September 29, 2021 08:17
Show Gist options
  • Save farhadmpr/f0d5f79c296d8b21ce788d360d5bcb07 to your computer and use it in GitHub Desktop.
Save farhadmpr/f0d5f79c296d8b21ce788d360d5bcb07 to your computer and use it in GitHub Desktop.
Ambient Context #3
class LocationManager: LocationService {
//....
func isAuthorized() -> Bool {
switch authorizationStatus() {
case .authorizedAlways,
.authorizedWhenInUse:
return true
default:
return false
}
}
//....
}
class DateProvider: DateProviderService {
var date: Date {
return Date()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment