Back to Alamofire

DataResponseSerializerProtocol

docs/Protocols/DataResponseSerializerProtocol.html

5.12.01.4 KB
Original Source

DataResponseSerializerProtocol

public protocol DataResponseSerializerProtocol<SerializedObject> : Sendable

The type to which all data response serializers must conform in order to serialize a response.

`

                SerializedObject
                `

The type of serialized object to be created.

Declaration

Swift

associatedtype SerializedObject : Sendable

`

                serialize(request:response:data:error:)
                `

Serialize the response Data into the provided type.

Throws

Any Error produced during serialization.

Declaration

Swift

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

Parameters

| request |

URLRequest which was used to perform the request, if any.

| | response |

HTTPURLResponse received from the server, if any.

| | data |

Data returned from the server, if any.

| | error |

Error produced by Alamofire or the underlying URLSession during the request.

|

Return Value

The SerializedObject.