@@ -71,7 +71,7 @@ public protocol URLSessionDelegate : NSObjectProtocol {
7171 * behavior will be to use the default handling, which may involve user
7272 * interaction.
7373 */
74- func urlSession( _ session: URLSession , didReceive challenge: URLAuthenticationChallenge , completionHandler: @escaping ( URLSession . AuthChallengeDisposition , URLCredential ? ) -> Void )
74+ func urlSession( _ session: URLSession , didReceive challenge: URLAuthenticationChallenge , completionHandler: @escaping ( URLSession . AuthChallengeDisposition , URLCredential ? ) -> Void )
7575}
7676
7777extension URLSessionDelegate {
@@ -115,19 +115,21 @@ public protocol URLSessionTaskDelegate : URLSessionDelegate {
115115 * necessary when authentication has failed for any request that
116116 * involves a body stream.
117117 */
118- func urlSession( _ session: URLSession , task: URLSessionTask , needNewBodyStream completionHandler: @escaping ( InputStream ? ) -> Void )
118+ func urlSession( _ session: URLSession , task: URLSessionTask , needNewBodyStream completionHandler: @escaping ( InputStream ? ) -> Void )
119119
120120 /* Sent periodically to notify the delegate of upload progress. This
121121 * information is also available as properties of the task.
122122 */
123- func urlSession( _ session: URLSession , task: URLSessionTask , didSendBodyData bytesSent: Int64 , totalBytesSent: Int64 , totalBytesExpectedToSend: Int64 )
123+ func urlSession( _ session: URLSession , task: URLSessionTask , didSendBodyData bytesSent: Int64 , totalBytesSent: Int64 , totalBytesExpectedToSend: Int64 )
124124
125125 /* Sent as the last message related to a specific task. Error may be
126126 * nil, which implies that no error occurred and this task is complete.
127127 */
128- func urlSession( _ session: URLSession , task: URLSessionTask , didCompleteWithError error: Error ? )
128+ func urlSession( _ session: URLSession , task: URLSessionTask , didCompleteWithError error: Error ? )
129129
130- func urlSession( _ session: URLSession , task: URLSessionTask , willBeginDelayedRequest request: URLRequest , completionHandler: @escaping ( URLSession . DelayedRequestDisposition , URLRequest ? ) -> Void )
130+ func urlSession( _ session: URLSession , task: URLSessionTask , willBeginDelayedRequest request: URLRequest , completionHandler: @escaping ( URLSession . DelayedRequestDisposition , URLRequest ? ) -> Void )
131+
132+ func urlSession( _ session: URLSession , task: URLSessionTask , didFinishCollecting metrics: URLSessionTaskMetrics )
131133}
132134
133135extension URLSessionTaskDelegate {
@@ -148,6 +150,8 @@ extension URLSessionTaskDelegate {
148150 public func urlSession( _ session: URLSession , task: URLSessionTask , didCompleteWithError error: Error ? ) { }
149151
150152 public func urlSession( _ session: URLSession , task: URLSessionTask , willBeginDelayedRequest request: URLRequest , completionHandler: @escaping ( URLSession . DelayedRequestDisposition , URLRequest ? ) -> Void ) { }
153+
154+ public func urlSession( _ session: URLSession , task: URLSessionTask , didFinishCollecting metrics: URLSessionTaskMetrics ) { }
151155}
152156
153157/*
@@ -204,7 +208,7 @@ public protocol URLSessionDataDelegate : URLSessionTaskDelegate {
204208 * attempted for a given resource, and you should not rely on this
205209 * message to receive the resource data.
206210 */
207- func urlSession( _ session: URLSession , dataTask: URLSessionDataTask , willCacheResponse proposedResponse: CachedURLResponse , completionHandler: @escaping ( CachedURLResponse ? ) -> Void )
211+ func urlSession( _ session: URLSession , dataTask: URLSessionDataTask , willCacheResponse proposedResponse: CachedURLResponse , completionHandler: @escaping ( CachedURLResponse ? ) -> Void )
208212
209213}
210214
@@ -232,17 +236,17 @@ public protocol URLSessionDownloadDelegate : URLSessionTaskDelegate {
232236 * removed when the delegate message returns. URLSession:task:didCompleteWithError: will
233237 * still be called.
234238 */
235- func urlSession( _ session: URLSession , downloadTask: URLSessionDownloadTask , didFinishDownloadingTo location: URL )
239+ func urlSession( _ session: URLSession , downloadTask: URLSessionDownloadTask , didFinishDownloadingTo location: URL )
236240
237241 /* Sent periodically to notify the delegate of download progress. */
238- func urlSession( _ session: URLSession , downloadTask: URLSessionDownloadTask , didWriteData bytesWritten: Int64 , totalBytesWritten: Int64 , totalBytesExpectedToWrite: Int64 )
242+ func urlSession( _ session: URLSession , downloadTask: URLSessionDownloadTask , didWriteData bytesWritten: Int64 , totalBytesWritten: Int64 , totalBytesExpectedToWrite: Int64 )
239243
240244 /* Sent when a download has been resumed. If a download failed with an
241245 * error, the -userInfo dictionary of the error will contain an
242246 * URLSessionDownloadTaskResumeData key, whose value is the resume
243247 * data.
244248 */
245- func urlSession( _ session: URLSession , downloadTask: URLSessionDownloadTask , didResumeAtOffset fileOffset: Int64 , expectedTotalBytes: Int64 )
249+ func urlSession( _ session: URLSession , downloadTask: URLSessionDownloadTask , didResumeAtOffset fileOffset: Int64 , expectedTotalBytes: Int64 )
246250}
247251
248252extension URLSessionDownloadDelegate {
@@ -259,13 +263,13 @@ public protocol URLSessionStreamDelegate : URLSessionTaskDelegate {
259263 * this delegate message is received, there may still be bytes
260264 * available. You only know that no more bytes are available when you
261265 * are able to read until EOF. */
262- func urlSession( _ session: URLSession , readClosedFor streamTask: URLSessionStreamTask )
266+ func urlSession( _ session: URLSession , readClosedFor streamTask: URLSessionStreamTask )
263267
264268 /* Indicates that the write side of a connection has been closed.
265269 * Any outstanding writes complete, but future writes will immediately
266270 * fail.
267271 */
268- func urlSession( _ session: URLSession , writeClosedFor streamTask: URLSessionStreamTask )
272+ func urlSession( _ session: URLSession , writeClosedFor streamTask: URLSessionStreamTask )
269273
270274 /* A notification that the system has determined that a better route
271275 * to the host has been detected (eg, a wi-fi interface becoming
@@ -274,15 +278,15 @@ public protocol URLSessionStreamDelegate : URLSessionTaskDelegate {
274278 * there is no guarantee that the future task will be able to connect
275279 * to the host, so callers should should be prepared for failure of
276280 * reads and writes over any new interface. */
277- func urlSession( _ session: URLSession , betterRouteDiscoveredFor streamTask: URLSessionStreamTask )
281+ func urlSession( _ session: URLSession , betterRouteDiscoveredFor streamTask: URLSessionStreamTask )
278282
279283 /* The given task has been completed, and unopened InputStream and
280284 * OutputStream objects are created from the underlying network
281285 * connection. This will only be invoked after all enqueued IO has
282286 * completed (including any necessary handshakes.) The streamTask
283287 * will not receive any further delegate messages.
284288 */
285- func urlSession( _ session: URLSession , streamTask: URLSessionStreamTask , didBecome inputStream: InputStream , outputStream: OutputStream )
289+ func urlSession( _ session: URLSession , streamTask: URLSessionStreamTask , didBecome inputStream: InputStream , outputStream: OutputStream )
286290}
287291
288292extension URLSessionStreamDelegate {
0 commit comments