Created
January 30, 2022 20:55
-
-
Save krzyzanowskim/18bd589b3355f84c7d2cbd9b7a9200ee to your computer and use it in GitHub Desktop.
NSTextLocation missing Equatable helper
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
extension NSTextLocation { | |
static func == (lhs: Self, rhs: Self) -> Bool { | |
lhs.compare(rhs) == .orderedSame | |
} | |
static func != (lhs: Self, rhs: Self) -> Bool { | |
lhs.compare(rhs) != .orderedSame | |
} | |
static func < (lhs: Self, rhs: Self) -> Bool { | |
lhs.compare(rhs) == .orderedAscending | |
} | |
static func <= (lhs: Self, rhs: Self) -> Bool { | |
lhs == rhs || lhs < rhs | |
} | |
static func > (lhs: Self, rhs: Self) -> Bool { | |
lhs.compare(rhs) == .orderedDescending | |
} | |
static func >= (lhs: Self, rhs: Self) -> Bool { | |
lhs == rhs || lhs > rhs | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment