Created
September 29, 2021 08:19
-
-
Save farhadmpr/c2ec432e4e40088df3eafd652fbaee9b to your computer and use it in GitHub Desktop.
Ambient Context #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MapViewModel { | |
// MARK: - Private Vars | |
private let locationService: LocationService | |
private let dateProviderService: DateProviderService | |
// MARK: - Init | |
init(locationService: LocationService, dateProviderService: DateProviderService) { | |
self.locationService = locationService | |
self.dateProviderService = dateProviderService | |
} | |
// MARK: - Methods | |
func performCriticalBusinessLogic() { | |
if locationService.isAuthorized() { | |
// GPS Service Authroized | |
} else { | |
// GPS Service not authorized | |
} | |
} | |
func performAnotherCriticalBusinessLogic() { | |
let currentDate = dateProviderService.date | |
if currentDate.isOnWeekend() { | |
// Perform business logic for weekends | |
} else { | |
// Perform business logic for week days | |
} | |
} | |
//.... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment