Skip to content

Commit

Permalink
Updates for Swift 4.1 and Xcode 9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
s4cha committed Apr 10, 2018
1 parent fbc7278 commit f61e984
Show file tree
Hide file tree
Showing 19 changed files with 52 additions and 39 deletions.
6 changes: 3 additions & 3 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "Alamofire/Alamofire" "4.5.1"
github "freshOS/Arrow" "3.0.5"
github "freshOS/then" "3.0.0"
github "Alamofire/Alamofire" "4.7.1"
github "freshOS/Arrow" "4.1.0"
github "freshOS/then" "4.0.0"
6 changes: 3 additions & 3 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "Alamofire/Alamofire" "4.5.1"
github "freshOS/Arrow" "3.0.5"
github "freshOS/then" "3.0.0"
github "Alamofire/Alamofire" "4.7.1"
github "freshOS/Arrow" "4.1.0"
github "freshOS/then" "4.0.0"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Alamofire
Submodule Alamofire updated 192 files
2 changes: 1 addition & 1 deletion Carthage/Checkouts/then
Submodule then updated 42 files
+80 −6 README.md
+1 −1 Source/Info.plist
+6 −1 Source/Promise+Delay.swift
+21 −0 Source/Promise+First.swift
+5 −10 Source/Promise+Race.swift
+22 −2 Source/Promise+Recover.swift
+3 −14 Source/Promise+Timeout.swift
+102 −47 Source/Promise+Zip.swift
+21 −0 Source/Promise+nil.swift
+5 −29 Source/Promise.swift
+1 −4 Source/PromiseError.swift
+35 −0 Source/VoidPromise.swift
+12 −8 Source/WhenAll.swift
+ then.framework.zip
+177 −135 then.xcodeproj/project.pbxproj
+8 −0 then.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+2 −5 then.xcodeproj/xcshareddata/xcschemes/then.xcscheme
+1 −3 then.xcodeproj/xcshareddata/xcschemes/thenMacOS.xcscheme
+1 −3 then.xcodeproj/xcshareddata/xcschemes/thenTvOS.xcscheme
+1 −1 thenMacOS/Info.plist
+1 −1 thenPromise.podspec
+7 −7 thenTests/AsyncAwaitTests.swift
+9 −9 thenTests/BridgeErrorTests.swift
+6 −6 thenTests/ChainTests.swift
+15 −15 thenTests/DelayTests.swift
+11 −11 thenTests/FinallyTests.swift
+3 −3 thenTests/Helpers.swift
+1 −1 thenTests/MemoryTests.swift
+2 −2 thenTests/NoMatterWhatTests.swift
+10 −10 thenTests/OnErrorTests.swift
+3 −3 thenTests/ProgressTests.swift
+47 −16 thenTests/RaceTests.swift
+47 −13 thenTests/RecoverTests.swift
+26 −27 thenTests/RegisterThenTests.swift
+6 −6 thenTests/RetryTests.swift
+11 −12 thenTests/ThenTests.swift
+9 −9 thenTests/TimeoutTests.swift
+3 −3 thenTests/UnwrapTests.swift
+7 −7 thenTests/ValidateTests.swift
+11 −11 thenTests/WhenAllTests.swift
+19 −19 thenTests/ZipTests.swift
+1 −1 thenTvOS/Info.plist
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![License: MIT](http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat)](https://github.com/freshOS/ws/blob/master/LICENSE)
[![Build Status](https://www.bitrise.io/app/a6d157138f9ee86d.svg?token=W7-x9K5U976xiFrI8XqcJw)](https://www.bitrise.io/app/a6d157138f9ee86d)
[![codebeat badge](https://codebeat.co/badges/78d86c16-aa61-4a5e-8342-1aea8d437453)](https://codebeat.co/projects/github-com-freshos-ws)
[![Release version](https://img.shields.io/badge/release-3.0-blue.svg)]()
![Release version](https://img.shields.io/github/release/freshos/ws.svg)

[Reason](#why) - [Example](#usage) - [Installation](#installation)

Expand Down Expand Up @@ -423,10 +423,11 @@ use_frameworks!
Swift 2 -> version **1.3.0**
Swift 3 -> version **2.0.4**
Swift 4 -> version **3.0.0**
Swift 4.1 -> version **3.1.0**


### Backers
Like the project? Offer coffee or support us with a monthly donation and help us continue our activities :)
Like the project? Offer coffee or support us with a monthly donation and help us continue our activities :)

<a href="https://opencollective.com/freshos/backer/0/website" target="_blank"><img src="https://opencollective.com/freshos/backer/0/avatar.svg"></a>
<a href="https://opencollective.com/freshos/backer/1/website" target="_blank"><img src="https://opencollective.com/freshos/backer/1/avatar.svg"></a>
Expand Down Expand Up @@ -460,7 +461,7 @@ Like the project? Offer coffee or support us with a monthly donation and help us
<a href="https://opencollective.com/freshos/backer/29/website" target="_blank"><img src="https://opencollective.com/freshos/backer/29/avatar.svg"></a>

### Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site :)
Become a sponsor and get your logo on our README on Github with a link to your site :)

<a href="https://opencollective.com/freshos/sponsor/0/website" target="_blank"><img src="https://opencollective.com/freshos/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/freshos/sponsor/1/website" target="_blank"><img src="https://opencollective.com/freshos/sponsor/1/avatar.svg"></a>
Expand Down
Binary file modified ws.framework.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion ws.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "ws"
s.version = "3.0.0"
s.version = "3.1.0"
s.summary = "Elegant JSON WebService for Swift ☁️"
s.homepage = "https://github.com/freshOS/ws"
s.license = { :type => "MIT", :file => "LICENSE" }
Expand Down
6 changes: 5 additions & 1 deletion ws.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = s4cha;
TargetAttributes = {
996CAB8F1BF67A7C00931EAD = {
Expand Down Expand Up @@ -562,12 +562,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -618,12 +620,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
4 changes: 1 addition & 3 deletions ws.xcodeproj/xcshareddata/xcschemes/ws.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
2 changes: 1 addition & 1 deletion ws/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.0.0</string>
<string>3.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion ws/WS+Requests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public typealias Params = [String :Any]
public typealias Params = [String: Any]

extension WS {

Expand Down
6 changes: 3 additions & 3 deletions ws/WS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ open class WS {
fileName: String,
mimeType: String) -> Promise<JSON> {
let r = postMultipartRequest(url,
params:params,
name:name,
params: params,
name: name,
data: data,
fileName: fileName,
mimeType: mimeType)
Expand All @@ -144,7 +144,7 @@ open class WS {
data: Data,
fileName: String,
mimeType: String) -> Promise<JSON> {
let r = putMultipartRequest(url, params:params, name:name, data: data, fileName: fileName, mimeType: mimeType)
let r = putMultipartRequest(url, params: params, name: name, data: data, fileName: fileName, mimeType: mimeType)
return r.fetch().resolveOnMainThread()
}

Expand Down
2 changes: 1 addition & 1 deletion ws/WSLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class WSLogger {

private func logBody(_ urlRequest: URLRequest) {
if let body = urlRequest.httpBody,
let str = String(data:body, encoding: .utf8) {
let str = String(data: body, encoding: .utf8) {
print(" HttpBody : \(str)")
}
}
Expand Down
13 changes: 7 additions & 6 deletions ws/WSRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ open class WSRequest {
WSNetworkIndicator.shared.startRequest()
}
if self.isMultipart {
self.sendMultipartRequest(resolve, reject: reject, progress:progress)
self.sendMultipartRequest(resolve, reject: reject, progress: progress)
} else if !self.returnsJSON {
self.sendRequest(resolve, reject: reject)
} else {
Expand Down Expand Up @@ -112,7 +112,8 @@ open class WSRequest {
withName: self.multipartName,
fileName: self.multipartFileName,
mimeType: self.multipartMimeType)
}, with: self.buildRequest()) { encodingResult in
}, with: self.buildRequest(),
encodingCompletion: { encodingResult in
switch encodingResult {
case .success(let upload, _, _):
upload.uploadProgress { p in
Expand All @@ -122,15 +123,15 @@ open class WSRequest {
}
case .failure: ()
}
}
})
logger.logMultipartRequest(self)
}

func sendRequest(_ resolve:@escaping (_ result: (Int, [AnyHashable: Any], JSON)) -> Void,
reject: @escaping (_ error: Error) -> Void) {
self.req = request(self.buildRequest())
logger.logRequest(self.req!)
let bgQueue = DispatchQueue.global(qos:DispatchQoS.QoSClass.default)
let bgQueue = DispatchQueue.global(qos: DispatchQoS.QoSClass.default)
req?.validate().response(queue: bgQueue) { response in
WSNetworkIndicator.shared.stopRequest()
self.logger.logResponse(response)
Expand Down Expand Up @@ -167,10 +168,10 @@ open class WSRequest {
}
resolve((response.response?.statusCode ?? 0, response.response?.allHeaderFields ?? [:], json))
} else {
rejectCallWithMatchingError(response.response, data:response.data, reject: reject)
rejectCallWithMatchingError(response.response, data: response.data, reject: reject)
}
case .failure:
rejectCallWithMatchingError(response.response, data:response.data, reject: reject)
rejectCallWithMatchingError(response.response, data: response.data, reject: reject)
}
}

Expand Down
8 changes: 4 additions & 4 deletions wsTests/Mapping.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Arrow

extension User:ArrowParsable {
extension User: ArrowParsable {
mutating func deserialize(_ json: JSON) {
identifier <-- json["id"]
username <-- json["username"]
Expand All @@ -22,15 +22,15 @@ extension User:ArrowParsable {
}
}

extension Company:ArrowParsable {
extension Company: ArrowParsable {
mutating func deserialize(_ json: JSON) {
bs <-- json["bs"]
catchPhrase <-- json["catchPhrase"]
name <-- json["name"]
}
}

extension Address:ArrowParsable {
extension Address: ArrowParsable {
mutating func deserialize(_ json: JSON) {
city <-- json["city"]
street <-- json["street"]
Expand All @@ -40,7 +40,7 @@ extension Address:ArrowParsable {
}
}

extension Geo:ArrowParsable {
extension Geo: ArrowParsable {
mutating func deserialize(_ json: JSON) {
lat <-- json["lat"]
lng <-- json["lng"]
Expand Down
6 changes: 3 additions & 3 deletions wsTests/mappingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class MappingTests: XCTestCase {
})
.onError({ error in
print("ERROR: \(error)")
XCTFail()
XCTFail("Mapping fails")
e.fulfill()
})

Expand All @@ -105,7 +105,7 @@ class MappingTests: XCTestCase {
})
.onError({ error in
print("ERROR: \(error)")
XCTFail()
XCTFail("Type Mapping Fails")
e.fulfill()
})

Expand All @@ -122,7 +122,7 @@ class MappingTests: XCTestCase {
})
.onError({ error in
print("ERROR: \(error)")
XCTFail()
XCTFail("Raw type mapping fails")
e.fulfill()
})

Expand Down
7 changes: 4 additions & 3 deletions wsTests/wsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class WSTests: XCTestCase {
wsFileIO.postMultipart("", name: "file", data: data, fileName: "file", mimeType: "image/jpeg").then { _ in
exp.fulfill()
}.onError { _ in
XCTFail()
XCTFail("Posting multipart Fails")
}
waitForExpectations(timeout: 10, handler: nil)
}
Expand All @@ -129,15 +129,16 @@ class WSTests: XCTestCase {
}
}

fetch().resolveOnMainThread()
fetch()
.resolveOnMainThread()
.then { data in
print(data)
thenExp.fulfill()
}.onError { error in
print(error)
}.finally {
finallyExp.fulfill()
}
}

waitForExpectations(timeout: 1, handler: nil)
}
Expand Down

0 comments on commit f61e984

Please sign in to comment.