From 1e6952244d5cf5b5bf4bb5f69a4d9810e6007658 Mon Sep 17 00:00:00 2001 From: Matt <85322+mattmassicotte@users.noreply.github.com> Date: Fri, 8 Dec 2023 09:24:00 -0500 Subject: [PATCH] adding <=, >, >= for NSTextLocation --- Sources/Rearrange/NSTextLocation+Comparable.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/Rearrange/NSTextLocation+Comparable.swift b/Sources/Rearrange/NSTextLocation+Comparable.swift index 7753542..6839758 100644 --- a/Sources/Rearrange/NSTextLocation+Comparable.swift +++ b/Sources/Rearrange/NSTextLocation+Comparable.swift @@ -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