CodableParser

open class CodableParser<Model> : DataResponseSerializerProtocol where Model : Decodable

CodableParser is a wrapper around modelDecoder and errorDecoder JSONDecoders to be used when decoding JSON response.

  • Decoder used for decoding model object

    Declaration

    Swift

    public let modelDecoder: JSONDecoder
  • Creates CodableParser with model and error decoders

    Declaration

    Swift

    public init(modelDecoder: JSONDecoder)
  • Method used by response handlers that takes a request, response, data and error and returns a result.

    Declaration

    Swift

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