Skip to content

Instantly share code, notes, and snippets.

@krzyzanowskim
Created January 30, 2022 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krzyzanowskim/18bd589b3355f84c7d2cbd9b7a9200ee to your computer and use it in GitHub Desktop.
Save krzyzanowskim/18bd589b3355f84c7d2cbd9b7a9200ee to your computer and use it in GitHub Desktop.
NSTextLocation missing Equatable helper
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