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 8dca2f5 commit 292859a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
20 changes: 20 additions & 0 deletions Sources/Rearrange/NSTextLocation+Comparable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#if canImport(AppKit)
import AppKit
#elseif canImport(UIKit)
import UIKit
#endif

#if os(iOS) || os(tvOS) || os(macOS)

@available(iOS 15.0, macOS 12.0, tvOS 15.0, *)
extension NSTextLocation {
public static func < (lhs: Self, rhs: Self) -> Bool {
return lhs.compare(rhs) == .orderedAscending
}

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

#endif
7 changes: 0 additions & 7 deletions Sources/Rearrange/NSTextRange+NSRange.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ import UIKit

#if os(iOS) || os(tvOS) || os(macOS)

@available(iOS 15.0, macOS 12.0, tvOS 15.0, *)
public extension NSTextLocation {
static func < (lhs: Self, rhs: Self) -> Bool {
return lhs.compare(rhs) == .orderedAscending
}
}

@available(iOS 15.0, macOS 12.0, tvOS 15.0, *)
public extension NSRange {
init(_ textRange: NSTextRange, provider: NSTextElementProvider) {
Expand Down

0 comments on commit 292859a

Please sign in to comment.