Instance Methodswift 6.0.3Swift
encodeIfPresent(_:forKey:)
mutating func encodeIfPresent<T>(_ value: T?, forKey key: KeyedEncodingContainer<K>.Key) throws where T : Encodable
mutating func encodeIfPresent<T>(_ value: T?, forKey key: KeyedEncodingContainer<K>.Key) throws where T : Encodable
ss22KeyedEncodingContainerV15encodeIfPresent_6forKeyyqd__Sg_xtKSERd__lF
What are these?45LA3
import Swift
struct KeyedEncodingContainer<K> where K : CodingKey
A concrete container that provides a view into an encoder’s storage, making the encoded properties of an encodable type accessible by keys.
protocol Encodable
A type that can encode itself to an external representation.
init<Container>(_ container: Container) where K == Container.Key, Container : KeyedEncodingContainerProtocol
Creates a new instance with the given container.
var codingPath: [any CodingKey] { get }
mutating func encode(_ value: String, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode(_ value: Bool, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode(_ value: Double, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode(_ value: Float, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode(_ value: Int, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode(_ value: UInt, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode<T>(_ value: T, forKey key: KeyedEncodingContainer<K>.Key) throws where T : Encodable
mutating func encode(_ value: Int8, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode(_ value: Int16, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode(_ value: Int32, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode(_ value: Int64, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode(_ value: UInt8, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode(_ value: Int128, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode(_ value: UInt16, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode(_ value: UInt32, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode(_ value: UInt64, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encode(_ value: UInt128, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeConditional<T>(_ object: T, forKey key: KeyedEncodingContainer<K>.Key) throws where T : AnyObject, T : Encodable
mutating func encodeIfPresent(_ value: String?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: Bool?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: Double?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: Float?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: Int?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: UInt?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: Int8?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: Int16?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: Int32?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: Int64?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: UInt8?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: Int128?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: UInt16?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: UInt32?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: UInt64?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeIfPresent(_ value: UInt128?, forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func encodeNil(forKey key: KeyedEncodingContainer<K>.Key) throws
mutating func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type, forKey key: KeyedEncodingContainer<K>.Key) -> KeyedEncodingContainer<NestedKey> where NestedKey : CodingKey
mutating func nestedUnkeyedContainer(forKey key: KeyedEncodingContainer<K>.Key) -> any UnkeyedEncodingContainer
mutating func superEncoder() -> any Encoder
mutating func superEncoder(forKey key: KeyedEncodingContainer<K>.Key) -> any Encoder
typealias Key = K