Skip to content

Commit ae21fb3

Browse files
spevansianpartridge
authored andcommitted
NSTextCheckingResult: Rename method to match Darwin (#1231)
- resultByAdjustingRangesWithOffset() -> adjustingRanges(offset:)
1 parent 7eefc15 commit ae21fb3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Foundation/NSTextCheckingResult.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ internal class _NSRegularExpressionNSTextCheckingResultResult : NSTextCheckingRe
8787

8888
extension NSTextCheckingResult {
8989

90-
public func resultByAdjustingRangesWithOffset(_ offset: Int) -> NSTextCheckingResult {
90+
public func adjustingRanges(offset: Int) -> NSTextCheckingResult {
9191
let count = self.numberOfRanges
9292
var newRanges = [NSRange]()
9393
for idx in 0..<count {

TestFoundation/TestNSTextCheckingResult.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ class TestNSTextCheckingResult: XCTestCase {
3434
let searchRange = NSMakeRange(0,7)
3535
let match: NSTextCheckingResult = regex.firstMatch(in: searchString, options: searchOptions, range: searchRange)!
3636
//Positive offset
37-
var result = match.resultByAdjustingRangesWithOffset(1)
37+
var result = match.adjustingRanges(offset: 1)
3838
XCTAssertEqual(result.range(at: 0).location, 6)
3939
XCTAssertEqual(result.range(at: 1).location, NSNotFound)
4040
XCTAssertEqual(result.range(at: 2).location, 6)
4141
//Negative offset
42-
result = match.resultByAdjustingRangesWithOffset(-2)
42+
result = match.adjustingRanges(offset: -2)
4343
XCTAssertEqual(result.range(at: 0).location, 3)
4444
XCTAssertEqual(result.range(at: 1).location, NSNotFound)
4545
XCTAssertEqual(result.range(at: 2).location, 3)
4646
//ZeroOffset
47-
result = match.resultByAdjustingRangesWithOffset(0)
47+
result = match.adjustingRanges(offset: 0)
4848
XCTAssertEqual(result.range(at: 0).location, 5)
4949
XCTAssertEqual(result.range(at: 1).location, NSNotFound)
5050
XCTAssertEqual(result.range(at: 2).location, 5)

0 commit comments

Comments
 (0)