A type that can encode values into a native format for external representation.
SDK
- Xcode 9.0+
Framework
- Swift Standard Library
Declaration
protocol Encoder
A type that can encode values into a native format for external representation.
SDK
Framework
protocol Encoder
var coding Path: [Coding Key]The path of coding keys taken to get to this point in encoding.
Required.
var user Info: [Coding User Info Key : Any]Any contextual information set by the user for encoding.
Required.
func container<Key>(keyed By: Key .Type) -> Keyed Encoding Container<Key>Returns an encoding container appropriate for holding multiple values keyed by the given key type.
Required.
func single Value Container() -> Single Value Encoding ContainerReturns an encoding container appropriate for holding a single primitive value.
Required.
func unkeyed Container() -> Unkeyed Encoding ContainerReturns an encoding container appropriate for holding multiple unkeyed values.
Required.
protocol DecoderA type that can decode values from a native format into in-memory representations.
enum Encoding ErrorAn error that occurs during the encoding of a value.
enum Decoding ErrorAn error that occurs during the decoding of a value.