TRONDownloadResponseSerializer
public struct TRONDownloadResponseSerializer<Model> : DownloadResponseSerializerProtocol
Response serializer, that wraps serialization closure to implement Alamofire.DownloadResponseSerializerProtocol
. Is used for DownloadAPIRequest
.
-
Serialization closure to execute
Declaration
Swift
public let closure: ((URLRequest?, HTTPURLResponse?, URL?, Error?) throws -> Model)
-
Creates response serializer from passed serialization closure
Declaration
Swift
public init(closure: @escaping (URLRequest?, HTTPURLResponse?, URL?, Error?) throws -> Model)
Parameters
closure
serialization closure
-
Serializes received response into model object
Throws
serialization errors.Declaration
Swift
public func serializeDownload(request: URLRequest?, response: HTTPURLResponse?, fileURL: URL?, error: Error?) throws -> Model
Parameters
request
URLRequest
that was sent to receive response.response
HTTP response object that was received
fileURL
File URL where downloaded file was placed after successful download.
error
Error, received by URL loading system or Alamofire.
Return Value
serialized model object