Skip to content

Commit 07876ff

Browse files
committed
Upgrades Alamofire and PromiseKit
1 parent 4e1a59a commit 07876ff

File tree

5 files changed

+16
-28
lines changed

5 files changed

+16
-28
lines changed

BuckoNetworking/Bucko.swift

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,6 @@ public protocol BuckoErrorHandler: class {
1515

1616
public typealias BuckoResponseClosure = ((DataResponse<Any>) -> Void)
1717
public typealias BuckoDataResponseClosure = ((DataResponse<Data>) -> Void)
18-
@available(*, deprecated, message: "Use HTTPMethod instead")
19-
public typealias HttpMethod = HTTPMethod
20-
@available(*, deprecated, message: "Use HTTPHeaders instead")
21-
public typealias HttpHeaders = HTTPHeaders
22-
@available(*, deprecated, message: "Use ParameterEncoding instead")
23-
public typealias Encoding = ParameterEncoding
24-
@available(*, deprecated, message: "Use URLEncoding instead")
25-
public typealias UrlEncoding = URLEncoding
26-
@available(*, deprecated, message: "Use JSONEncoding instead")
27-
public typealias JsonEncoding = JSONEncoding
28-
@available(*, deprecated, message: "Use Parameters instead")
29-
public typealias Body = Parameters
3018

3119
public struct Bucko {
3220
/**
@@ -157,39 +145,39 @@ public struct Bucko {
157145
}
158146

159147
public func request(endpoint: Endpoint) -> Promise<DataResponse<Any>> {
160-
return Promise { fullfill, reject in
148+
return Promise { seal in
161149
request(endpoint: endpoint) { response in
162150

163151
if response.result.isSuccess {
164-
fullfill(response)
152+
seal.fulfill(response)
165153
} else {
166154
if let responseError = response.result.value {
167155
do {
168156
let json = try JSONSerialization.data(withJSONObject: responseError, options: [])
169-
reject(BuckoError(apiError: json))
157+
seal.reject(BuckoError(apiError: json))
170158
} catch {
171-
reject(response.result.error!)
159+
seal.reject(response.result.error!)
172160
}
173161
} else {
174-
reject(response.result.error!)
162+
seal.reject(response.result.error!)
175163
}
176164
}
177165
}
178166
}
179167
}
180168

181169
public func requestData(endpoint: Endpoint) -> Promise<Data> {
182-
return Promise { fulfill, reject in
170+
return Promise { seal in
183171
requestData(endpoint: endpoint) { response in
184172

185173
if response.result.isSuccess {
186-
fulfill(response.result.value!)
174+
seal.fulfill(response.result.value!)
187175
} else {
188176

189177
if let responseError = response.result.value {
190-
reject(BuckoError(apiError: responseError))
178+
seal.reject(BuckoError(apiError: responseError))
191179
} else {
192-
reject(response.result.error!)
180+
seal.reject(response.result.error!)
193181
}
194182
}
195183
}

BuckoNetworking/Protocols/DecodableEndpoint.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public extension DecodableEndpoint {
3535

3636
public func request() -> Promise<ResponseType> {
3737
return Bucko.shared.requestData(endpoint: self).then { data in
38-
return Promise { fullfill, _ in
38+
return Promise { seal in
3939
let result = try JSONDecoder().decode(ResponseType.self, from: data)
40-
fullfill(result)
40+
seal.fulfill(result)
4141
}
4242
}
4343
}

BuckoNetworking/Protocols/Endpoint.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ public extension Endpoint {
8787

8888
public func request<T: Decodable>(responseType: T.Type) -> Promise<T> {
8989
return Bucko.shared.requestData(endpoint: self).then { data in
90-
return Promise { fullfill, _ in
90+
return Promise { seal in
9191
let result = try JSONDecoder().decode(T.self, from: data)
92-
fullfill(result)
92+
seal.fulfill(result)
9393
}
9494
}
9595
}

Cartfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
github "Alamofire/Alamofire" ~> 4.4
2-
github "mxcl/PromiseKit" ~> 4.5
1+
github "Alamofire/Alamofire" ~> 4.6.0
2+
github "mxcl/PromiseKit" ~> 6.1.0

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
github "Alamofire/Alamofire" "4.6.0"
2-
github "mxcl/PromiseKit" "4.5.0"
2+
github "mxcl/PromiseKit" "6.1.0"

0 commit comments

Comments
 (0)