AnyResponseSerializer

public class AnyResponseSerializer<Value> : ResponseSerializer

Undocumented

  • A closure which can be used to serialize data responses.

    Declaration

    Swift

    public typealias DataSerializer = (_ request: URLRequest?, _ response: HTTPURLResponse?, _ data: Data?, _ error: Error?) throws -> Value
  • A closure which can be used to serialize download reponses.

    Declaration

    Swift

    public typealias DownloadSerializer = (_ request: URLRequest?, _ response: HTTPURLResponse?, _ fileURL: URL?, _ error: Error?) throws -> Value
  • Initializes the ResponseSerializer instance with the given serialize response closure.

    Declaration

    Swift

    public init(dataSerializer: @escaping DataSerializer, downloadSerializer: @escaping DownloadSerializer)

    Parameters

    dataSerializer

    A DataSerializer closure.

    downloadSerializer

    A DownloadSerializer closure.

  • Initialze the instance with a DataSerializer closure. Download serialization will fallback to a default implementation.

    Declaration

    Swift

    public init(dataSerializer: @escaping DataSerializer)

    Parameters

    dataSerializer

    A DataSerializer closure.

  • Undocumented

    Declaration

    Swift

    public func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> Value
  • Undocumented

    Declaration

    Swift

    public func serializeDownload(request: URLRequest?, response: HTTPURLResponse?, fileURL: URL?, error: Error?) throws -> Value