ResponseSerializer

public struct ResponseSerializer<Value, Error: ErrorType>: ResponseSerializerType

A generic ResponseSerializerType used to serialize a request, response, and data into a serialized object.

  • A closure used by response handlers that takes a request, response, data and error and returns a result.

    Declaration

    Swift

    public var serializeResponse: (NSURLRequest?, NSHTTPURLResponse?, NSData?, NSError?) -> Result<Value, Error>
  • The type of error to be created by this ResponseSerializer if serialization fails.

    Declaration

    Swift

    public typealias ErrorObject = Error
  • The type of serialized object to be created by this ResponseSerializer.

    Declaration

    Swift

    public typealias SerializedObject = Value
  • Initializes the ResponseSerializer instance with the given serialize response closure.

    Declaration

    Swift

    public init(serializeResponse: (NSURLRequest?, NSHTTPURLResponse?, NSData?, NSError?) -> Result<Value, Error>)

    Parameters

    serializeResponse

    The closure used to serialize the response.

    Return Value

    The new generic response serializer instance.