UnkeyedEncodingContainer

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.

Encoders should provide types conforming to UnkeyedEncodingContainer for their format.

Import import Swift

Instance Variables

var codingPath: [CodingKey] Required

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

Declaration

var codingPath: [CodingKey] { get }
var count: Int Required

The number of elements encoded into the container.

Declaration

var count: Int { get }

Instance Methods

mutating func encode(_: Bool) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode(_ value: Bool) throws
mutating func encode(_: Double) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode(_ value: Double) throws
mutating func encode(_: Float) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode(_ value: Float) throws
mutating func encode(_: Int) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode(_ value: Int) throws
mutating func encode(_: Int8) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode(_ value: Int8) throws
mutating func encode(_: Int16) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode(_ value: Int16) throws
mutating func encode(_: Int32) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode(_ value: Int32) throws
mutating func encode(_: Int64) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode(_ value: Int64) throws
mutating func encode(_: String) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode(_ value: String) throws
mutating func encode(_: UInt) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode(_ value: UInt) throws
mutating func encode(_: UInt8) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode(_ value: UInt8) throws
mutating func encode(_: UInt16) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode(_ value: UInt16) throws
mutating func encode(_: UInt32) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode(_ value: UInt32) throws
mutating func encode(_: UInt64) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode(_ value: UInt64) throws
mutating func encode<T>(_: T) Required

Encodes the given value.

value: The value to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encode<T>(_ value: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Encodes the elements of the given sequence.

sequence: The sequences whose contents to encode. throws: An error if any of the contained values throws an error.

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encodeConditional(_:)

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

For encoders which don't support this feature, the default implementation encodes the given object unconditionally.

For formats which don't support this feature, the default implementation encodes the given object unconditionally.

object: The object to encode. throws: EncodingError.invalidValue if the given value is invalid in the current context for this format.

Declaration

mutating func encodeConditional<T>(_ object: T) throws
mutating func encodeNil() Required

Encodes a null value.

throws: EncodingError.invalidValue if a null value is invalid in the current context for this format.

Declaration

mutating func encodeNil() throws
mutating func nestedContainer(keyedBy:) Required

Encodes a nested container keyed by the given type and returns it.

keyType: The key type to use for the container. returns: A new keyed encoding container.

Declaration

mutating func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> where NestedKey : CodingKey
mutating func nestedUnkeyedContainer() Required

Encodes an unkeyed encoding container and returns it.

returns: A new unkeyed encoding container.

Declaration

mutating func nestedUnkeyedContainer() -> UnkeyedEncodingContainer
mutating func superEncoder() Required

Encodes a nested container and returns an Encoder instance for encoding super into that container.

returns: A new encoder to pass to super.encode(to:).

Declaration

mutating func superEncoder() -> Encoder

Default Implementations

mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encode<T>(contentsOf: T)

Declaration

mutating func encode<T>(contentsOf sequence: T) throws
mutating func encodeConditional(_:)

Declaration

mutating func encodeConditional<T>(_ object: T) throws