Instance Method
decode(_:from:boundary:)
Decodes a
Decodable item from someMultipartPartBodyElement using the supplied boundary.func decode<D, Body>(_ decodable: D.Type, from buffer: Body, boundary: String) throws -> D where D : Decodable, Body : RangeReplaceableCollection, Body : Sendable, Body.Element == UInt8, Body.SubSequence : Equatable, Body.SubSequence : Sendable
Parameters
decodableGeneric
Decodabletype.bufferSome
MultipartPartBodyElementto decode.boundaryMultipart 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.