ResponseTransformer
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.
Warning
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. -
debugDescription
Extension methodPrints the name of the transformer’s Swift type.
Declaration
Swift
public var debugDescription: String { get }
-
logTransformation(_:
Extension method) Helper to log a transformation. Call this in your custom transformer.