TRONDataResponseSerializer

public struct TRONDataResponseSerializer<Model> : DataResponseSerializerProtocol

Response serializer, that wraps serialization closure to implement Alamofire.DataResponseSerializerProtocol. Is used for APIRequest and UploadAPIRequest.

  • Serialization closure to execute

    Declaration

    Swift

    public let closure: ((URLRequest?, HTTPURLResponse?, Data?, Error?) throws -> Model)
  • Creates response serializer from passed serialization closure

    Declaration

    Swift

    public init(closure: @escaping (URLRequest?, _ response: HTTPURLResponse?, _ data: Data?, _ error: Error?) throws -> Model)

    Parameters

    closure

    serialization closure

  • Serializes received response into model object

    Throws

    serialization errors.

    Declaration

    Swift

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

    Parameters

    request

    URLRequest that was sent to receive response.

    response

    HTTP response object that was received

    data

    Data object that was received.

    error

    Error, received by URL loading system or Alamofire.

    Return Value

    serialized model object