Back to Alamofire

SessionDelegate

docs/Classes/SessionDelegate.html

5.12.06.2 KB
Original Source

SessionDelegate

open class SessionDelegate : NSObject, @unchecked Sendable
extension SessionDelegate: URLSessionDelegate
extension SessionDelegate: URLSessionTaskDelegate
extension SessionDelegate: URLSessionDataDelegate
extension SessionDelegate: URLSessionWebSocketDelegate
extension SessionDelegate: URLSessionDownloadDelegate

Class which implements the various URLSessionDelegate methods to connect various Alamofire features.

`

                init(fileManager:)
                `

Creates an instance from the given FileManager.

Declaration

Swift

public init(fileManager: FileManager = .default)

Parameters

| fileManager |

FileManager to use for underlying file management, such as moving downloaded files. .default by default.

|

URLSessionDelegate

`

                urlSession(_:didBecomeInvalidWithError:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession, didBecomeInvalidWithError error: (any Error)?)

URLSessionTaskDelegate

`

                urlSession(_:task:didReceive:completionHandler:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession,
                     task: URLSessionTask,
                     didReceive challenge: URLAuthenticationChallenge,
                     completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)

`

                urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession,
                     task: URLSessionTask,
                     didSendBodyData bytesSent: Int64,
                     totalBytesSent: Int64,
                     totalBytesExpectedToSend: Int64)

`

                urlSession(_:task:needNewBodyStream:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession,
                     task: URLSessionTask,
                     needNewBodyStream completionHandler: @escaping (InputStream?) -> Void)

`

                urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession,
                     task: URLSessionTask,
                     willPerformHTTPRedirection response: HTTPURLResponse,
                     newRequest request: URLRequest,
                     completionHandler: @escaping (URLRequest?) -> Void)

`

                urlSession(_:task:didFinishCollecting:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics)

`

                urlSession(_:task:didCompleteWithError:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: (any Error)?)

`

                urlSession(_:taskIsWaitingForConnectivity:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask)

URLSessionDataDelegate

`

                urlSession(_:dataTask:didReceive:completionHandler:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession,
                     dataTask: URLSessionDataTask,
                     didReceive response: URLResponse,
                     completionHandler: @escaping @Sendable (URLSession.ResponseDisposition) -> Void)

`

                urlSession(_:dataTask:didReceive:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data)

`

                urlSession(_:dataTask:willCacheResponse:completionHandler:)
                `

Undocumented

Declaration

Swift

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

URLSessionWebSocketDelegate

`

                urlSession(_:webSocketTask:didOpenWithProtocol:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession, webSocketTask: URLSessionWebSocketTask, didOpenWithProtocol protocol: String?)

`

                urlSession(_:webSocketTask:didCloseWith:reason:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession, webSocketTask: URLSessionWebSocketTask, didCloseWith closeCode: URLSessionWebSocketTask.CloseCode, reason: Data?)

URLSessionDownloadDelegate

`

                urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession,
                     downloadTask: URLSessionDownloadTask,
                     didResumeAtOffset fileOffset: Int64,
                     expectedTotalBytes: Int64)

`

                urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession,
                     downloadTask: URLSessionDownloadTask,
                     didWriteData bytesWritten: Int64,
                     totalBytesWritten: Int64,
                     totalBytesExpectedToWrite: Int64)

`

                urlSession(_:downloadTask:didFinishDownloadingTo:)
                `

Undocumented

Declaration

Swift

open func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL)