Skip to content

Commit 556d708

Browse files
committed
Moved NSRange clamped(_:) extension to common package
The NSRange clamped(_:) extension was moved from the STTextViewAppKit/STTextView+NSTextCheckingClient.swift file to a new file STTextViewCommon/Extensions/NSRange+Helpers.swift in the common package so it can be shared between different packages.
1 parent 28baa1e commit 556d708

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

Sources/STTextViewAppKit/STTextView+NSTextCheckingClient.swift

-12
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,3 @@ extension STTextView: NSIgnoreMisspelledWords {
329329
}
330330

331331
}
332-
333-
private extension NSRange {
334-
func clamped(_ limits: NSRange) -> Self? {
335-
guard let limits = Range(limits),
336-
let clampedRange = Range(self)?.clamped(to: limits)
337-
else {
338-
return nil
339-
}
340-
341-
return Self(clampedRange)
342-
}
343-
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Foundation
2+
3+
package extension NSRange {
4+
func clamped(_ limits: NSRange) -> Self? {
5+
guard let limits = Range(limits),
6+
let clampedRange = Range(self)?.clamped(to: limits)
7+
else {
8+
return nil
9+
}
10+
11+
return Self(clampedRange)
12+
}
13+
}
14+

0 commit comments

Comments
 (0)