Required Instance Methodswift 6.0.3Swift

encode(_:forKey:)

Encodes the given value for the given key.

mutating func encode<T>(_ value: T, forKey key: Self.Key) throws where T : Encodable

Parameters

value

The value to encode.

key

The key to associate the value with.

Throws

EncodingError.invalidValue if the given value is invalid in the current context for this format.