Skip to content

Instance Method

decode(_:from:boundary:)

Decodes a Decodable item from Data using the supplied boundary.
func decode<D>(_ decodable: D.Type, from buffer: ByteBuffer, boundary: String) throws -> D where D : Decodable

Parameters

decodable

Generic Decodable type.

boundary

Multipart boundary to used in the decoding.

Return Value

An instance of the decoded type D.

Discussion

let foo = try FormDataDecoder().decode(Foo.self, from: data, boundary: "123")

Throws

Any errors decoding the model with Codable or parsing the data.