Encoder
public extension Encoder
-
Encode a singular value into this encoder.
Declaration
Swift
func encodeSingleValue<T>(_ value: T) throws where T : Encodable
-
Encode a value for a given key, specified as a string.
Declaration
Swift
func encode<T>(_ value: T, for key: String) throws where T : Encodable
-
Encode a value for a given key, specified as a
CodingKey
.Declaration
Swift
func encode<T, K>(_ value: T, for key: K) throws where T : Encodable, K : CodingKey
-
Encode a date for a given key (specified as a string), using a specific formatter. To encode a date without using a specific formatter, simply encode it like any other value.
Declaration
Swift
func encode<F>(_ date: Date, for key: String, using formatter: F) throws where F : AnyDateFormatter
-
Encode a date for a given key (specified using a
CodingKey
), using a specific formatter. To encode a date without using a specific formatter, simply encode it like any other value.Declaration
Swift
func encode<K: CodingKey, F: AnyDateFormatter>( _ date: Date, for key: K, using formatter: F ) throws