Instance Method
decode(_:from:)
Decodes an instance of the supplied
Decodable type from a String.func decode<D>(_: D.Type, from string: String) throws -> D where D : Decodable
Parameters
decodableA
DecodabletypeDto decode.stringString to decode a
Dfrom.
Return Value
An instance of D.
Discussion
print(data) // "name=Vapor&age=3"
let user = try URLEncodedFormDecoder().decode(User.self, from: data)
print(user) // User
Throws
Any error that may occur while attempting to decode the specified type.