encode(_:forKey:)
Encodes the given value for the given key.
mutating func encode(_ value: Int8, forKey key: Self.Key) throws
Parameters
Throws
EncodingError.invalidValue
if the given value is invalid in the current context for this format.
Encodes the given value for the given key.
mutating func encode(_ value: Int8, forKey key: Self.Key) throws
ss30KeyedEncodingContainerProtocolP6encode_6forKeyys4Int8V_0G0QztKF
What are these?QJNA
EncodingError.invalidValue
if the given value is invalid in the current context for this format.
import Swift
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.
@frozen struct Int8
An 8-bit signed integer value type.
associatedtype Key : CodingKey
var codingPath: [any CodingKey] { get }
The path of coding keys taken to get to this point in encoding.
mutating func encode(_ value: String, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encode(_ value: Bool, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encode(_ value: Double, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encode(_ value: Float, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encode(_ value: Int, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encode(_ value: UInt, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encode<T>(_ value: T, forKey key: Self.Key) throws where T : Encodable
Encodes the given value for the given key.
mutating func encode(_ value: Int16, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encode(_ value: Int32, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encode(_ value: Int64, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encode(_ value: UInt8, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encode(_ value: Int128, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encode(_ value: UInt16, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encode(_ value: UInt32, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encode(_ value: UInt64, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encode(_ value: UInt128, forKey key: Self.Key) throws
Encodes the given value for the given key.
mutating func encodeConditional<T>(_ object: T, forKey key: Self.Key) throws where T : AnyObject, T : Encodable
Encodes a reference to the given object only if it is encoded unconditionally elsewhere in the payload (previously, or in the future).
mutating func encodeIfPresent(_ value: String?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: Bool?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: Double?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: Float?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: Int?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: UInt?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent<T>(_ value: T?, forKey key: Self.Key) throws where T : Encodable
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: Int8?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: Int16?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: Int32?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: Int64?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: UInt8?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: Int128?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: UInt16?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: UInt32?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: UInt64?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeIfPresent(_ value: UInt128?, forKey key: Self.Key) throws
Encodes the given value for the given key if it is not nil
.
mutating func encodeNil(forKey key: Self.Key) throws
Encodes a null value for the given key.
mutating func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type, forKey key: Self.Key) -> KeyedEncodingContainer<NestedKey> where NestedKey : CodingKey
Stores a keyed encoding container for the given key and returns it.
mutating func nestedUnkeyedContainer(forKey key: Self.Key) -> any UnkeyedEncodingContainer
Stores an unkeyed encoding container for the given key and returns it.
mutating func superEncoder() -> any Encoder
Stores a new nested container for the default super
key and returns a new encoder instance for encoding super
into that container.
mutating func superEncoder(forKey key: Self.Key) -> any Encoder
Stores a new nested container for the given key and returns a new encoder instance for encoding super
into that container.
mutating func encode(_ value: Int128, forKey key: Self.Key) throws
mutating func encode(_ value: UInt128, forKey key: Self.Key) throws