Encodable
protocol Encodable
-
Directly encodes any
Encodable
object using any given encoder conforming to theAnyEncoder
protocol.This generic instance method returns an encoded representation of a value adopting the
Encodable
protocol. The encoder used must conform to theAnyEncoder
protocol but is of typeJSONEncoder
by default.Declaration
Swift
func encoded(using encoder: AnyEncoder = JSONEncoder()) throws -> Data
Return Value
An encoded object.