SessionDelegate

open class SessionDelegate: NSObject

Responsible for handling all delegate callbacks for the underlying session.

  • Initializes the SessionDelegate instance.

    Declaration

    Swift

    public override init()
  • Returns a Bool indicating whether the SessionDelegate implements or inherits a method that can respond to a specified message.

    Declaration

    Swift

    open override func responds(to selector: Selector) -> Bool
  • Tells the delegate that the data task received the initial reply (headers) from the server.

    Declaration

    Swift

    open func urlSession(
            _ session: URLSession,
            dataTask: URLSessionDataTask,
            didReceive response: URLResponse,
            completionHandler: @escaping (URLSession.ResponseDisposition) -> Void)
  • Tells the delegate that the data task was changed to a download task.

    Declaration

    Swift

    open func urlSession(
            _ session: URLSession,
            dataTask: URLSessionDataTask,
            didBecome downloadTask: URLSessionDownloadTask)
  • Tells the delegate that the data task has received some of the expected data.

    Declaration

    Swift

    open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data)
  • Asks the delegate whether the data (or upload) task should store the response in the cache.

    Declaration

    Swift

    open func urlSession(
            _ session: URLSession,
            dataTask: URLSessionDataTask,
            willCacheResponse proposedResponse: CachedURLResponse,
            completionHandler: @escaping (CachedURLResponse?) -> Void)