Skip to content

Instantly share code, notes, and snippets.

@andeeliao
Created August 15, 2019 18:20
Show Gist options
  • Save andeeliao/d913fe32113f437d2a3168ec541f94c0 to your computer and use it in GitHub Desktop.
Save andeeliao/d913fe32113f437d2a3168ec541f94c0 to your computer and use it in GitHub Desktop.
reverse comparison
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