Downloadable

public protocol Downloadable: ADownloadable, Configurable, DownloadResponseSerializable

Represents a Downloadable for Restofire.

protocol HTTPBinDownloadService: Downloadable {

    var path: String? = "bytes/\(4 * 1024 * 1024)"
    var destination: DownloadFileDestination?

    init(destination: @escaping DownloadFileDestination) {
        self.destination = destination
    }

}
  • request(_:didDownloadProgress:) Default implementation

    Called when the Request updates with download progress.

    Default Implementation

    Does Nothing

    Declaration

    Swift

    func request(_ request: DownloadRequest, didDownloadProgress progress: Progress)

    Parameters

    request

    The Alamofire.DownloadRequest

    progress

    The Progress

  • request(_:didCompleteWithValue:) Default implementation

    Called when the Request succeeds.

    Default Implementation

    Does Nothing

    Declaration

    Swift

    func request(_ request: DownloadRequest, didCompleteWithValue value: Response)

    Parameters

    request

    The Alamofire.DownloadRequest

    value

    The Response

  • request(_:didFailWithError:) Default implementation

    Called when the Request fails

    Default Implementation

    Does Nothing

    Declaration

    Swift

    func request(_ request: DownloadRequest, didFailWithError error: Error)

    Parameters

    request

    The Alamofire.DownloadRequest

    error

    The Error

  • response(_:) Extension method

    Creates a DownloadOperation for the specified Requestable object and asynchronously executes it.

    Declaration

    Swift

    public func response(_ completionHandler: ((DownloadResponse<Response>) -> Void)? = nil) -> DownloadOperation<Self>

    Parameters

    completionHandler

    A closure to be executed once the download has finished. nil by default.

    Return Value

    The created DownloadOperation.