public protocol ResponseTransformer: CustomDebugStringConvertible

Transforms a response from a less parsed form (e.g. Data) to a more parsed data structure. Responses pass through a chain of transformers before being sent to response hooks or observers.


Transformers run in a GCD background queue, and must be thread-safe. You’re in the clear if your transformer touches only its input parameters, and those parameters are value types or otherwise exclusively owned.
  • Returns the parsed form of this response, or returns it unchanged if this transformer does not apply.

    Note that a Response can contain either data or an error, so this method can turn success into failure if the response fails to parse.



    func process(_ response: Response) -> Response