protocol Encoder
Import | import Swift |
---|
Instance Variables
The path of coding keys taken to get to this point in encoding.
Declaration
var codingPath: [CodingKey] { get }
Any contextual information set by the user for encoding.
Declaration
var userInfo: [CodingUserInfoKey : Any] { get }
Instance Methods
Returns an encoding container appropriate for holding multiple values keyed by the given key type.
You must use only one kind of top-level encoding container. This method
must not be called after a call to unkeyedContainer()
or after
encoding a value through a call to singleValueContainer()
type
: The key type to use for the container.
returns: A new keyed encoding container.
Declaration
func container<Key>(keyedBy type: Key.Type) -> KeyedEncodingContainer<Key> where Key : CodingKey
Returns an encoding container appropriate for holding a single primitive value.
You must use only one kind of top-level encoding container. This method
must not be called after a call to unkeyedContainer()
or
container(keyedBy:)
, or after encoding a value through a call to
singleValueContainer()
returns: A new empty single value container.
Declaration
func singleValueContainer() -> SingleValueEncodingContainer
Returns an encoding container appropriate for holding multiple unkeyed values.
You must use only one kind of top-level encoding container. This method
must not be called after a call to container(keyedBy:)
or after
encoding a value through a call to singleValueContainer()
returns: A new empty unkeyed container.
Declaration
func unkeyedContainer() -> UnkeyedEncodingContainer
A type that can encode values into a native format for external representation.