Skip to content

Instantly share code, notes, and snippets.

@farhadmpr
Created September 29, 2021 08:20
Show Gist options
  • Save farhadmpr/39b386b96f5023a78f0258326a45e077 to your computer and use it in GitHub Desktop.
Save farhadmpr/39b386b96f5023a78f0258326a45e077 to your computer and use it in GitHub Desktop.
Ambient Context #5
class LocationManagerStub: LocationService {
var isLocationServiceAuthorized: Bool
init(isLocationServiceAuthorized: Bool) {
self.isLocationServiceAuthorized = isLocationServiceAuthorized
}
func isAuthorized() -> Bool {
return isLocationServiceAuthorized
}
//....
}
class DateProviderStub: DateProviderService {
var dateComponents: DateComponents
init(dateComponents: DateComponents) {
self.dateComponents = dateComponents
}
var date: Date {
return dateComponents.date!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment