ソースを参照

Removed the Int64 progress variant APIs from the documentation.

Christian Noon 9 年 前
コミット
91208b44be
2 ファイル変更4 行追加48 行削除
  1. 2 20
      Documentation/Alamofire 4.0 Migration Guide.md
  2. 2 28
      README.md

+ 2 - 20
Documentation/Alamofire 4.0 Migration Guide.md

@@ -586,7 +586,7 @@ By making this split, Alamofire 4 was able to create customized chaining APIs fo
 
 #### Download and Upload Progress
 
-The progress reporting system for data, download and upload requests has been completely redesigned. Each request type contains two types of progress APIs, one that passes a `Progress` instance and the other that passes broken out `Int64` values. Both APIs will call the closure on a specified dispatch queue that defaults to main.
+The progress reporting system for data, download and upload requests has been completely redesigned. Each request type contains progress APIs for executing a closure during each progress update by returning the underlying `Progress` instance. The closure will be called on the specified queue that defaults to main.
 
 **Data Request Progress**
 
@@ -596,17 +596,11 @@ Alamofire.request(urlString)
         // Called on main dispatch queue by default
         print("Download progress: \(progress.fractionCompleted)")
     }
-    .downloadProgress(queue: DispatchQueue.utility) { bytesRead, totalBytesRead, totalBytesExpectedToRead in
-        // Called on utility dispatch queue
-        print("Read: \(bytesRead), Total Read: \(totalBytesRead), Total Expected: \(totalBytesExpectedToRead)")
-    }
     .responseJSON { response in
         debugPrint(response)
     }
 ```
 
-> Please note that you would not actually chain both `downloadProgress` APIs onto the same request. Both are shown in this example just to show the differences in usage.
-
 **Download Request Progress**
 
 ```swift
@@ -615,10 +609,6 @@ Alamofire.download(urlString, to: destination)
         // Called on utility dispatch queue
         print("Download progress: \(progress.fractionCompleted)")
     }
-    .downloadProgress { bytesRead, totalBytesRead, totalBytesExpectedToRead in
-        // Called on main dispatch queue by default
-        print("Read: \(bytesRead), Total Read: \(totalBytesRead), Total Expected: \(totalBytesExpectedToRead)")
-    }
     .responseJSON { response in
         debugPrint(response)
     }
@@ -632,24 +622,16 @@ Alamofire.upload(data, to: urlString, withMethod: .post)
         // Called on main dispatch queue by default
         print("Upload progress: \(progress.fractionCompleted)")
     }
-    .uploadProgress(queue: DispatchQueue.utility) { bytesSent, totalBytesSent, totalBytesExpectedToSend in
-        // Can customize the dispatch queue for background operations if needed
-        print("Sent: \(bytesSent), Total Sent: \(totalBytesSent), Total Expected: \(totalBytesExpectedToSend)")
-    }
     .downloadProgress { progress in
         // Called on main dispatch queue by default
         print("Download progress: \(progress.fractionCompleted)")
     }
-    .downloadProgress { bytesRead, totalBytesRead, totalBytesExpectedToRead in
-        // Called on main dispatch queue by default
-        print("Read: \(bytesRead), Total Read: \(totalBytesRead), Total Expected: \(totalBytesExpectedToRead)")
-    }
     .responseData { response in
         debugPrint(response)
     }
 ```
 
-It's now easy to differentiate between upload and download progress for upload requests. Deciding with to use the `Progress` or `Int64` variant is purely personal preference. We would recommend using the `Progress` APIs though purely for convenience.
+It's now easy to differentiate between upload and download progress for upload requests.
 
 > See [PR-1455](https://github.com/Alamofire/Alamofire/pull/1455) for more info.
 

+ 2 - 28
README.md

@@ -638,10 +638,9 @@ Alamofire.download("https://httpbin.org/image/png", to: destination)
 
 #### Download Progress
 
-Many times it can be helpful to report download progress to the user. Any `DownloadRequest` can report download progress using the `downloadProgress` APIs.
+Many times it can be helpful to report download progress to the user. Any `DownloadRequest` can report download progress using the `downloadProgress` API.
 
 ```swift
-// Reports Progress with `Progress` instance
 Alamofire.download("https://httpbin.org/image/png")
     .downloadProgress { progress in
         print("Download Progress: \(progress.fractionCompleted)")
@@ -651,23 +650,11 @@ Alamofire.download("https://httpbin.org/image/png")
 	        let image = UIImage(data: data)
     	}
     }
-
-// Reports Progress with `Int64	` Values
-Alamofire.download("https://httpbin.org/image/png")
-    .downloadProgress { bytesRead, totalBytesReceived, totalBytesExpectedToRead in
-        print("Download Progress: \(bytesRead), \(totalBytesReceived), \(totalBytesExpectedToRead) bytes")
-    }
-    .responseData { response in
-    	if let data = response.result.value {
-	        let image = UIImage(data: data)
-    	}
-    }
 ```
 
-Both of the `downloadProgress` APIs also take a `queue` parameter which defines which `DispatchQueue` the download progress closure should be called on.
+The `downloadProgress` API also takes a `queue` parameter which defines which `DispatchQueue` the download progress closure should be called on.
 
 ```swift
-// Reports progress on the utility queue
 let utilityQueue = DispatchQueue.global(qos: .utility)
 
 Alamofire.download("https://httpbin.org/image/png")
@@ -775,7 +762,6 @@ While your user is waiting for their upload to complete, sometimes it can be han
 ```swift
 let fileURL = Bundle.main.url(forResource: "video", withExtension: "mov")
 
-// Reports Progress with `Progress` instance
 Alamofire.upload(fileURL, to: "https://httpbin.org/post")
     .uploadProgress { progress in // main queue by default
         print("Upload Progress: \(progress.fractionCompleted)")
@@ -786,18 +772,6 @@ Alamofire.upload(fileURL, to: "https://httpbin.org/post")
     .responseJSON { response in
         debugPrint(response)
     }
-
-// Reports Progress with `Int64	` Values
-Alamofire.upload(fileURL, to: "https://httpbin.org/post")
-    .uploadProgress { bytesSent, totalBytesSent, totalBytesExpectedToSend in // main queue by default
-        print("Upload Progress: \(bytesSent), \(totalBytesSent), \(totalBytesExpectedToSend) bytes")
-    }
-    .downloadProgress { bytesRead, totalBytesReceived, totalBytesExpectedToRead in // main queue by default
-        print("Download Progress: \(bytesRead), \(totalBytesReceived), \(totalBytesExpectedToRead) bytes")
-    }
-    .responseJSON { response in
-        debugPrint(response)
-    }
 ```
 
 ### Statistical Metrics