We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7e605c3 commit 243a89eCopy full SHA for 243a89e
Foundation/NSRange.swift
@@ -260,11 +260,7 @@ extension NSRange {
260
public init<R: RangeExpression, S: StringProtocol>(_ region: R, in target: S)
261
where R.Bound == S.Index {
262
let r = region.relative(to: target)
263
- let u = target.utf16
264
- self = NSRange(
265
- location: u.distance(from: target.startIndex, to: r.lowerBound),
266
- length: u.distance(from: r.lowerBound, to: r.upperBound)
267
- )
+ self.init(target._toUTF16Offsets(r))
268
}
269
270
@available(swift, deprecated: 4, renamed: "Range.init(_:)")
0 commit comments