Structure
Response
public struct Response<Input, Output>
A struct
defining the response
transformation.
Initializers
init(_:)
public init(_ content: @escaping (Input) throws -> Output)
Init.
Parameters
Name | Type | Description |
---|---|---|
content | @escaping (Input) throws -> Output |
A valid content factory. |
init(_:)
public init(_ content: @escaping (Data) throws -> Output) where Input == DefaultResponse
Init.
Parameters
Name | Type | Description |
---|---|---|
content | @escaping (Data) throws -> Output |
A simplified content factory, only accounting for the actual output. |
init(_:decoder:)
public init(
_ output: Output.Type,
decoder: JSONDecoder = .init()
) where Input == DefaultResponse, Output: Decodable
Init.
Parameters
Name | Type | Description |
---|---|---|
output | Output.Type |
The |
decoder | JSONDecoder |
A valid |
init(_:decoder:)
public init<D: TopLevelDecoder>(
_ output: Output.Type,
decoder: D
) where Input == DefaultResponse, Output: Decodable, D.Input == Data
Init.
Parameters
Name | Type | Description |
---|---|---|
output | Output.Type |
The |
decoder | D |
Some |