Created
September 29, 2021 08:14
-
-
Save farhadmpr/7e18c585bd9f644a6ce0a78cd7c6c5cb to your computer and use it in GitHub Desktop.
Ambient Context #1
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 LocationManager { | |
//.... | |
static func isAuthorized() -> Bool { | |
switch authorizationStatus() { | |
case .authorizedAlways, | |
.authorizedWhenInUse: | |
return true | |
default: | |
return false | |
} | |
} | |
//.... | |
} | |
class MapViewModel { | |
//.... | |
func performCriticalBusinessLogic() { | |
if LocationManager.isAuthorized() { | |
// GPS Service Authroized | |
} else { | |
// GPS Service not authorized | |
} | |
} | |
func performAnotherCriticalBusinessLogic() { | |
let currentDate = 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