@@ -71,7 +71,7 @@ public protocol URLSessionDelegate : NSObjectProtocol {
71
71
* behavior will be to use the default handling, which may involve user
72
72
* interaction.
73
73
*/
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 )
75
75
}
76
76
77
77
extension URLSessionDelegate {
@@ -115,19 +115,21 @@ public protocol URLSessionTaskDelegate : URLSessionDelegate {
115
115
* necessary when authentication has failed for any request that
116
116
* involves a body stream.
117
117
*/
118
- func urlSession( _ session: URLSession , task: URLSessionTask , needNewBodyStream completionHandler: @escaping ( InputStream ? ) -> Void )
118
+ func urlSession( _ session: URLSession , task: URLSessionTask , needNewBodyStream completionHandler: @escaping ( InputStream ? ) -> Void )
119
119
120
120
/* Sent periodically to notify the delegate of upload progress. This
121
121
* information is also available as properties of the task.
122
122
*/
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 )
124
124
125
125
/* Sent as the last message related to a specific task. Error may be
126
126
* nil, which implies that no error occurred and this task is complete.
127
127
*/
128
- func urlSession( _ session: URLSession , task: URLSessionTask , didCompleteWithError error: Error ? )
128
+ func urlSession( _ session: URLSession , task: URLSessionTask , didCompleteWithError error: Error ? )
129
129
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 )
131
133
}
132
134
133
135
extension URLSessionTaskDelegate {
@@ -148,6 +150,8 @@ extension URLSessionTaskDelegate {
148
150
public func urlSession( _ session: URLSession , task: URLSessionTask , didCompleteWithError error: Error ? ) { }
149
151
150
152
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 ) { }
151
155
}
152
156
153
157
/*
@@ -204,7 +208,7 @@ public protocol URLSessionDataDelegate : URLSessionTaskDelegate {
204
208
* attempted for a given resource, and you should not rely on this
205
209
* message to receive the resource data.
206
210
*/
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 )
208
212
209
213
}
210
214
@@ -232,17 +236,17 @@ public protocol URLSessionDownloadDelegate : URLSessionTaskDelegate {
232
236
* removed when the delegate message returns. URLSession:task:didCompleteWithError: will
233
237
* still be called.
234
238
*/
235
- func urlSession( _ session: URLSession , downloadTask: URLSessionDownloadTask , didFinishDownloadingTo location: URL )
239
+ func urlSession( _ session: URLSession , downloadTask: URLSessionDownloadTask , didFinishDownloadingTo location: URL )
236
240
237
241
/* 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 )
239
243
240
244
/* Sent when a download has been resumed. If a download failed with an
241
245
* error, the -userInfo dictionary of the error will contain an
242
246
* URLSessionDownloadTaskResumeData key, whose value is the resume
243
247
* data.
244
248
*/
245
- func urlSession( _ session: URLSession , downloadTask: URLSessionDownloadTask , didResumeAtOffset fileOffset: Int64 , expectedTotalBytes: Int64 )
249
+ func urlSession( _ session: URLSession , downloadTask: URLSessionDownloadTask , didResumeAtOffset fileOffset: Int64 , expectedTotalBytes: Int64 )
246
250
}
247
251
248
252
extension URLSessionDownloadDelegate {
@@ -259,13 +263,13 @@ public protocol URLSessionStreamDelegate : URLSessionTaskDelegate {
259
263
* this delegate message is received, there may still be bytes
260
264
* available. You only know that no more bytes are available when you
261
265
* are able to read until EOF. */
262
- func urlSession( _ session: URLSession , readClosedFor streamTask: URLSessionStreamTask )
266
+ func urlSession( _ session: URLSession , readClosedFor streamTask: URLSessionStreamTask )
263
267
264
268
/* Indicates that the write side of a connection has been closed.
265
269
* Any outstanding writes complete, but future writes will immediately
266
270
* fail.
267
271
*/
268
- func urlSession( _ session: URLSession , writeClosedFor streamTask: URLSessionStreamTask )
272
+ func urlSession( _ session: URLSession , writeClosedFor streamTask: URLSessionStreamTask )
269
273
270
274
/* A notification that the system has determined that a better route
271
275
* to the host has been detected (eg, a wi-fi interface becoming
@@ -274,15 +278,15 @@ public protocol URLSessionStreamDelegate : URLSessionTaskDelegate {
274
278
* there is no guarantee that the future task will be able to connect
275
279
* to the host, so callers should should be prepared for failure of
276
280
* reads and writes over any new interface. */
277
- func urlSession( _ session: URLSession , betterRouteDiscoveredFor streamTask: URLSessionStreamTask )
281
+ func urlSession( _ session: URLSession , betterRouteDiscoveredFor streamTask: URLSessionStreamTask )
278
282
279
283
/* The given task has been completed, and unopened InputStream and
280
284
* OutputStream objects are created from the underlying network
281
285
* connection. This will only be invoked after all enqueued IO has
282
286
* completed (including any necessary handshakes.) The streamTask
283
287
* will not receive any further delegate messages.
284
288
*/
285
- func urlSession( _ session: URLSession , streamTask: URLSessionStreamTask , didBecome inputStream: InputStream , outputStream: OutputStream )
289
+ func urlSession( _ session: URLSession , streamTask: URLSessionStreamTask , didBecome inputStream: InputStream , outputStream: OutputStream )
286
290
}
287
291
288
292
extension URLSessionStreamDelegate {
0 commit comments