Skip to content

Commit

Permalink
adding <=, >, >= for NSTextLocation
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Dec 8, 2023
1 parent 292859a commit 1e69522
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/Rearrange/NSTextLocation+Comparable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ extension NSTextLocation {
public static func == (lhs: Self, rhs: Self) -> Bool {
return lhs.compare(rhs) == .orderedSame
}

public static func <= (lhs: Self, rhs: Self) -> Bool {
return lhs < rhs || lhs == rhs
}

public static func > (lhs: Self, rhs: Self) -> Bool {
return lhs.compare(rhs) == .orderedDescending
}

public static func >= (lhs: Self, rhs: Self) -> Bool {
return lhs > rhs || lhs > rhs
}
}

#endif

0 comments on commit 1e69522

Please sign in to comment.