Skip to content

Commit 1fcef59

Browse files
committed
Fix building Swish 2.0 for Xcode 9.3
Xcode 9.3 brings along Swift 3.3, which has a couple _slightly_ different behaviors that need to be special cased. Our current release (3.0+) of Swish handles these changes already, but some users are unable to upgrade right now, and we shouldn't make their lives more difficult. This adds the fixes for Swift 3.3 without breaking compatibility for Swift 3.2 users.
1 parent 1cb37e1 commit 1fcef59

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

Source/Models/JSONDeserializer.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import Argo
22
import Result
33

4-
struct JSONDeserializer: Deserializer {
5-
func deserialize(_ data: Data?) -> Result<Any, SwishError> {
4+
public struct JSONDeserializer: Deserializer {
5+
public func deserialize(_ data: Data?) -> Result<Any, SwishError> {
66
let json = parseJSON(data)
77

88
return json.analysis(
99
ifSuccess: Result<Any, SwishError>.init,
1010
ifFailure: { .failure(.deserializationError($0.error)) }
1111
)
1212
}
13+
14+
public init() {}
1315
}
1416

1517
extension JSON: Parser {

Source/Protocols/Request.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ public extension Request where ResponseObject: Collection, ResponseObject.Iterat
2626

2727
public extension Request where ResponseObject == EmptyResponse {
2828
func parse(_ j: JSON) -> Result<ResponseObject, SwishError> {
29-
return .success()
29+
#if swift(>=3.3)
30+
return .success(())
31+
#else
32+
return .success()
33+
#endif
3034
}
3135
}

0 commit comments

Comments
 (0)