Skip to content

Commit aa08818

Browse files
committed
rename argment progressHandler to completionHandler in SessionAdapter protocol.
1 parent 8ebecd0 commit aa08818

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Sources/APIKit/Session.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ open class Session {
7272
progressHandler: { bytesSent, totalBytesSent, totalBytesExpectedToSend in
7373
progressHandler(bytesSent, totalBytesSent, totalBytesExpectedToSend)
7474
},
75-
handler: { data, urlResponse, error in
75+
completionHandler: { data, urlResponse, error in
7676
let result: Result<Request.Response, SessionTaskError>
7777

7878
switch (data, urlResponse, error) {

Sources/APIKit/SessionAdapter/SessionAdapter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public protocol SessionTask: class {
1111
/// with `Session`.
1212
public protocol SessionAdapter {
1313
/// Returns instance that conforms to `SessionTask`. `handler` must be called after success or failure.
14-
func createTask(with URLRequest: URLRequest, progressHandler: @escaping (Int64, Int64, Int64) -> Void, handler: @escaping (Data?, URLResponse?, Error?) -> Void) -> SessionTask
14+
func createTask(with URLRequest: URLRequest, progressHandler: @escaping (Int64, Int64, Int64) -> Void, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> SessionTask
1515

1616
/// Collects tasks from backend networking stack. `handler` must be called after collecting.
1717
func getTasks(with handler: @escaping ([SessionTask]) -> Void)

Sources/APIKit/SessionAdapter/URLSessionAdapter.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ open class URLSessionAdapter: NSObject, SessionAdapter, URLSessionDelegate, URLS
2626
}
2727

2828
/// Creates `URLSessionDataTask` instance using `dataTaskWithRequest(_:completionHandler:)`.
29-
open func createTask(with URLRequest: URLRequest, progressHandler: @escaping (Int64, Int64, Int64) -> Void, handler: @escaping (Data?, URLResponse?, Error?) -> Void) -> SessionTask {
29+
open func createTask(with URLRequest: URLRequest, progressHandler: @escaping (Int64, Int64, Int64) -> Void, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> SessionTask {
3030
let task = urlSession.dataTask(with: URLRequest)
3131

3232
setBuffer(NSMutableData(), forTask: task)
33-
setHandler(handler, forTask: task)
33+
setHandler(completionHandler, forTask: task)
3434
setProgressHandler(progressHandler, forTask: task)
3535

3636
return task

Tests/APIKitTests/TestComponents/TestSessionAdapter.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ class TestSessionAdapter: SessionAdapter {
5050
tasks = []
5151
}
5252

53-
func createTask(with URLRequest: URLRequest, progressHandler: @escaping (Int64, Int64, Int64) -> Void, handler: @escaping (Data?, URLResponse?, Swift.Error?) -> Void) -> SessionTask {
54-
let task = TestSessionTask(progressHandler: progressHandler, handler: handler)
53+
func createTask(with URLRequest: URLRequest, progressHandler: @escaping (Int64, Int64, Int64) -> Void, completionHandler: @escaping (Data?, URLResponse?, Swift.Error?) -> Void) -> SessionTask {
54+
let task = TestSessionTask(progressHandler: progressHandler, handler: completionHandler)
5555
tasks.append(task)
5656

5757
return task

0 commit comments

Comments
 (0)