protocol
Encoder
A type that can encode values into a native format for external representation.
Instance Variables
Any contextual information set by the user for encoding.
Declaration
var
userInfo
: [
CodingUserInfoKey
:
Any
]
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()
- parameter type: The key type to use for the 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()
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()
Declaration
func
unkeyedContainer
() -
>
UnkeyedEncodingContainer
The path of coding keys taken to get to this point in encoding.
Declaration
var
codingPath
: [
CodingKey
]