Skip to content

Commit 3f4d925

Browse files
committed
Drop Swift 3.x support
1 parent 2ceafd1 commit 3f4d925

3 files changed

Lines changed: 6 additions & 12 deletions

File tree

APIKit.podspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Pod::Spec.new do |s|
2323
:tag => "#{s.version}",
2424
}
2525

26+
s.pod_target_xcconfigs = { "SWIFT_VERSION" => "4.0" }
27+
2628
s.license = {
2729
:type => "MIT",
2830
:text => <<-LICENSE

Sources/APIKit/Serializations/URLEncodedSerialization.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ private func escape(_ string: String) -> String {
2727
let endIndex = string.index(index, offsetBy: batchSize, limitedBy: string.endIndex) ?? string.endIndex
2828
let range = startIndex..<endIndex
2929

30-
let substring = string.substring(with: range)
30+
let substring = String(string[range])
3131

3232
escaped += substring.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) ?? substring
3333

Tests/APIKitTests/BodyParametersType/MultipartFormDataParametersTests.swift

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ import Foundation
22
import XCTest
33
@testable import APIKit
44

5-
#if !swift(>=4.0)
6-
extension NSTextCheckingResult {
7-
fileprivate func range(at idx: Int) -> NSRange {
8-
return rangeAt(idx)
9-
}
10-
}
11-
#endif
12-
135
class MultipartFormDataParametersTests: XCTestCase {
146
// MARK: Entity
157
func testDataEntitySuccess() {
@@ -32,7 +24,7 @@ class MultipartFormDataParametersTests: XCTestCase {
3224

3325
let pattern = "^multipart/form-data; boundary=([\\w.]+)$"
3426
let regexp = try NSRegularExpression(pattern: pattern, options: [])
35-
let range = NSRange(location: 0, length: parameters.contentType.characters.count)
27+
let range = NSRange(location: 0, length: parameters.contentType.count)
3628
let match = regexp.matches(in: parameters.contentType, options: [], range: range)
3729
XCTAssertTrue(match.count > 0)
3830

@@ -65,7 +57,7 @@ class MultipartFormDataParametersTests: XCTestCase {
6557

6658
let pattern = "^multipart/form-data; boundary=([\\w.]+)$"
6759
let regexp = try NSRegularExpression(pattern: pattern, options: [])
68-
let range = NSRange(location: 0, length: parameters.contentType.characters.count)
60+
let range = NSRange(location: 0, length: parameters.contentType.count)
6961
let match = regexp.matches(in: parameters.contentType, options: [], range: range)
7062
XCTAssertTrue(match.count > 0)
7163

@@ -100,7 +92,7 @@ class MultipartFormDataParametersTests: XCTestCase {
10092

10193
let pattern = "^multipart/form-data; boundary=([\\w.]+)$"
10294
let regexp = try NSRegularExpression(pattern: pattern, options: [])
103-
let range = NSRange(location: 0, length: parameters.contentType.characters.count)
95+
let range = NSRange(location: 0, length: parameters.contentType.count)
10496
let match = regexp.matches(in: parameters.contentType, options: [], range: range)
10597
XCTAssertTrue(match.count > 0)
10698

0 commit comments

Comments
 (0)