Created
August 15, 2019 18:20
-
-
Save andeeliao/d913fe32113f437d2a3168ec541f94c0 to your computer and use it in GitHub Desktop.
reverse comparison
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
extension ComparisonResult { | |
func reversed() -> ComparisonResult { | |
switch self { | |
case .orderedAscending: | |
return .orderedDescending | |
case .orderedDescending: | |
return .orderedAscending | |
case .orderedSame: | |
return .orderedSame | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment