Generic Structure

KeyedEncodingContainer

A concrete container that provides a view into an encoder’s storage, making the encoded properties of an encodable type accessible by keys.

Declaration

struct KeyedEncodingContainer<K> where K : CodingKey

Topics

Initializers

init<Container>(Container)

Creates a new instance with the given container.

Instance Properties

var codingPath: [CodingKey]

The path of coding keys taken to get to this point in encoding.

Instance Methods

func encode(UInt64, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encode<T>(T, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encode(UInt32, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encode(String, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encode(Int16, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encode(Double, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encode(Int64, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encode(Int8, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encode(Int, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encode(Float, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encode(UInt8, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encode(Bool, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encode(UInt, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encode(UInt16, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encode(Int32, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key.

func encodeConditional<T>(T, forKey: KeyedEncodingContainer<K>.Key)

Encodes a reference to the given object only if it is encoded unconditionally elsewhere in the payload (previously, or in the future).

func encodeConditional<T>(T, forKey: K)

Encodes a reference to the given object only if it is encoded unconditionally elsewhere in the payload (previously, or in the future).

func encodeIfPresent(UInt8?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeIfPresent(Double?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeIfPresent(UInt32?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeIfPresent(Float?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeIfPresent(Int8?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeIfPresent<T>(T?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeIfPresent(UInt?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeIfPresent(Int32?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeIfPresent(Int16?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeIfPresent(UInt16?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeIfPresent(Int64?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeIfPresent(Bool?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeIfPresent(UInt64?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeIfPresent(String?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeIfPresent(Int?, forKey: KeyedEncodingContainer<K>.Key)

Encodes the given value for the given key if it is not nil.

func encodeNil(forKey: KeyedEncodingContainer<K>.Key)

Encodes a null value for the given key.

func nestedUnkeyedContainer(forKey: KeyedEncodingContainer<K>.Key) -> UnkeyedEncodingContainer

Stores an unkeyed encoding container for the given key and returns it.

func superEncoder() -> Encoder

Stores a new nested container for the default super key and returns A new encoder instance for encoding super into that container.

func superEncoder(forKey: KeyedEncodingContainer<K>.Key) -> Encoder

Stores a new nested container for the given key and returns A new encoder instance for encoding super into that container.

Relationships

See Also

Encoding Containers

protocol SingleValueEncodingContainer

A container that can support the storage and direct encoding of a single non-keyed value.

protocol KeyedEncodingContainerProtocol

A type that provides a view into an encoder’s storage and is used to hold the encoded properties of an encodable type in a keyed manner.

protocol UnkeyedEncodingContainer

A type that provides a view into an encoder’s storage and is used to hold the encoded properties of an encodable type sequentially, without keys.