Created
May 19, 2021 09:25
-
-
Save thatswiftguy/31af75a017f9b01421ba245a5b5af3ed to your computer and use it in GitHub Desktop.
This file contains hidden or 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
let now = Date() | |
let olderDate = Date(timeIntervalSinceNow: -10000) | |
var order = Calendar.current.compare(now, to: olderDate, toGranularity: .day) | |
switch order { | |
case .orderedDescending: | |
print("DESCENDING") | |
case .orderedAscending: | |
print("ASCENDING") | |
case .orderedSame: | |
print("SAME") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment