Skip to content

You're viewing documentation for a pre-release version. View the latest stable version

Instance Method

decode(_:from:boundary:)

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

Parameters

decodable

Generic Decodable type.

string

String to decode.

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: "...", boundary: "123")

Throws

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