Instance Method
decode(_:from:boundary:)
Decodes a
Decodable item from String using the supplied boundary.func decode<D>(_ decodable: D.Type, from data: String, boundary: String) throws -> D where D : Decodable
Parameters
decodableGeneric
Decodabletype.dataString to 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: "...", boundary: "123")
Throws
Any errors decoding the model with Codable or parsing the data.