Protocol

CodingKey

A type that can be used as a key for encoding and decoding.

Topics

Initializers

init?(intValue: Int)

Creates a new instance from the specified integer.

Required.

init?(stringValue: String)

Creates a new instance from the given string.

Required.

Instance Properties

var intValue: Int?

The value to use in an integer-indexed collection (e.g. an int-keyed dictionary).

Required.

var stringValue: String

The string to use in a named collection (e.g. a string-keyed dictionary).

Required.

See Also

Custom Encoding and Decoding

Encoding and Decoding Custom Types

Make your data types encodable and decodable for compatibility with external representations such as JSON.

typealias Codable

A type that can convert itself into and out of an external representation.

protocol Encodable

A type that can encode itself to an external representation.

protocol Decodable

A type that can decode itself from an external representation.

struct CodingUserInfoKey

A user-defined key for providing context during encoding and decoding.