Class

URLSessionTaskMetrics

An NSURLSessionTaskMetrics object encapsulates the metrics for a session task. Each object contains the taskInterval and redirectCount, as well as metrics for each request / response transaction made during the execution of the task.

Topics

Accessing Task Metrics

var transactionMetrics: [URLSessionTaskTransactionMetrics]

Returns an array of metrics for each individual request / response transaction made during the execution of the task.

class URLSessionTaskTransactionMetrics

An NSURLSessionTaskTransactionMetrics object encapsulates the performance metrics collected during the execution of a session task. Each object consists of a request and response property, corresponding to the request and response of the corresponding task. It also contains temporal metrics, starting with fetchStartDate and ending with responseEndDate, as well as other characteristics like networkProtocolName and resourceFetchType.

var taskInterval: DateInterval

Returns the time interval between when a task is instantiated and when the task is completed.

var redirectCount: Int

Returns the number of redirects that occurred during the execution of the task.

Initializers

Relationships

Inherits From

Conforms To

See Also

Delegate Methods

func urlSession(URLSession, task: URLSessionTask, didSendBodyData: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64)

Periodically informs the delegate of the progress of sending body content to the server.

func urlSession(URLSession, task: URLSessionTask, needNewBodyStream: (InputStream?) -> Void)

Tells the delegate when a task requires a new request body stream to send to the remote server.

func urlSession(URLSession, task: URLSessionTask, didFinishCollecting: URLSessionTaskMetrics)

Tells the delegate that the session finished collecting metrics for the task.

func urlSession(URLSession, task: URLSessionTask, didCompleteWithError: Error?)

Tells the delegate that the task finished transferring data.

func urlSession(URLSession, taskIsWaitingForConnectivity: URLSessionTask)

Tells the delegate that the task is waiting until suitable connectivity is available before beginning the network load.