Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1
4.0
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ matrix:
include:
- os: osx
language: objective-c
osx_image: xcode8.3
osx_image: xcode9
script:
- set -o pipefail
- xcodebuild build-for-testing test-without-building -workspace APIKit.xcworkspace -scheme APIKit -configuration Release ENABLE_TESTABILITY=YES | xcpretty -c
Expand All @@ -16,7 +16,7 @@ matrix:
- bash <(curl -s https://codecov.io/bash)
- os: osx
language: generic
osx_image: xcode8.3
osx_image: xcode9
script:
- swift build
- swift test
Expand Down
2 changes: 2 additions & 0 deletions APIKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Pod::Spec.new do |s|
:tag => "#{s.version}",
}

s.pod_target_xcconfigs = { "SWIFT_VERSION" => "4.0" }

s.license = {
:type => "MIT",
:text => <<-LICENSE
Expand Down
20 changes: 16 additions & 4 deletions APIKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
7F7048ED1D9D8A12003C99F6 /* ResponseError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ResponseError.swift; path = Sources/APIKit/Error/ResponseError.swift; sourceTree = SOURCE_ROOT; };
7F7048EE1D9D8A12003C99F6 /* SessionTaskError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SessionTaskError.swift; path = Sources/APIKit/Error/SessionTaskError.swift; sourceTree = SOURCE_ROOT; };
7F7048F21D9D8A1F003C99F6 /* URLEncodedSerialization.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = URLEncodedSerialization.swift; path = Sources/APIKit/Serializations/URLEncodedSerialization.swift; sourceTree = SOURCE_ROOT; };
7F8ECDFD1B6A799E00234E04 /* Demo.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = Demo.playground; sourceTree = "<group>"; };
7F8ECDFD1B6A799E00234E04 /* Demo.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = Demo.playground; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
7FA1690C1D9D8C80006C982B /* HTTPStub.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTTPStub.swift; sourceTree = "<group>"; };
CD5115241B1FFBA900514240 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; };
ECA831471DE4DDBF004EB1B5 /* ProtobufDataParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProtobufDataParser.swift; path = Sources/APIKit/DataParser/ProtobufDataParser.swift; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -402,7 +402,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0810;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Yosuke Ishikawa";
TargetAttributes = {
141F12161C1C9ABE0026D415 = {
Expand Down Expand Up @@ -562,23 +562,35 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 141F12101C1C96820026D415 /* Debug.xcconfig */;
buildSettings = {
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
ENABLE_TESTABILITY = YES;
GCC_NO_COMMON_BLOCKS = YES;
ONLY_ACTIVE_ARCH = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
7F45FCF21A94D02C006863BB /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 141F12111C1C96820026D415 /* Release.xcconfig */;
buildSettings = {
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
GCC_NO_COMMON_BLOCKS = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
4 changes: 3 additions & 1 deletion APIKit.xcodeproj/xcshareddata/xcschemes/APIKit.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0810"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,6 +40,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
Expand Down Expand Up @@ -70,6 +71,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
16 changes: 16 additions & 0 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 17 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
// swift-tools-version:4.0
import PackageDescription

let package = Package(
name: "APIKit",
products: [
.library(name: "APIKit", targets: ["APIKit"]),
],
dependencies: [
.Package(url: "https://github.com/antitypical/Result.git", majorVersion: 3),
.package(url: "https://github.com/antitypical/Result.git", from: "3.0.0"),
],
targets: [
.target(
name: "APIKit",
dependencies: ["Result"],
exclude: ["BodyParameters/AbstractInputStream.m"]
),
.testTarget(
name: "APIKitTests",
dependencies: ["APIKit"]
),
],
exclude: ["Sources/APIKit/BodyParameters/AbstractInputStream.m"]
swiftLanguageVersions: [4]
)
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private func escape(_ string: String) -> String {
let endIndex = string.index(index, offsetBy: batchSize, limitedBy: string.endIndex) ?? string.endIndex
let range = startIndex..<endIndex

let substring = string.substring(with: range)
let substring = String(string[range])

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class MultipartFormDataParametersTests: XCTestCase {

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

let boundary = (parameters.contentType as NSString).substring(with: match.first!.rangeAt(1))
let boundary = (parameters.contentType as NSString).substring(with: match.first!.range(at: 1))
XCTAssertEqual(parameters.contentType, "multipart/form-data; boundary=\(boundary)")
XCTAssertEqual(encodedData, "--\(boundary)\(returnCode)Content-Disposition: form-data; name=\"foo\"\(returnCode)\(returnCode)1\(returnCode)--\(boundary)\(returnCode)Content-Disposition: form-data; name=\"bar\"\(returnCode)\(returnCode)2\(returnCode)--\(boundary)--\(returnCode)")
} catch {
Expand Down Expand Up @@ -57,11 +57,11 @@ class MultipartFormDataParametersTests: XCTestCase {

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

let boundary = (parameters.contentType as NSString).substring(with: match.first!.rangeAt(1))
let boundary = (parameters.contentType as NSString).substring(with: match.first!.range(at: 1))
XCTAssertEqual(parameters.contentType, "multipart/form-data; boundary=\(boundary)")
XCTAssertEqual(encodedData, "--\(boundary)\(returnCode)Content-Disposition: form-data; name=\"foo\"\(returnCode)\(returnCode)1\(returnCode)--\(boundary)\(returnCode)Content-Disposition: form-data; name=\"bar\"\(returnCode)\(returnCode)2\(returnCode)--\(boundary)--\(returnCode)")
} catch {
Expand Down Expand Up @@ -92,11 +92,11 @@ class MultipartFormDataParametersTests: XCTestCase {

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

let boundary = (parameters.contentType as NSString).substring(with: match.first!.rangeAt(1))
let boundary = (parameters.contentType as NSString).substring(with: match.first!.range(at: 1))
XCTAssertEqual(parameters.contentType, "multipart/form-data; boundary=\(boundary)")
XCTAssertEqual(encodedData, "--\(boundary)\(returnCode)Content-Disposition: form-data; name=\"test\"; filename=\"test.json\"\r\nContent-Type: application/json\(returnCode)\(returnCode)\(testString)\(returnCode)--\(boundary)--\(returnCode)")
} catch {
Expand Down