A type that can be used as a key for encoding and decoding.
SDK
- Xcode 9.0+
Framework
- Swift Standard Library
Declaration
protocol CodingKey
A type that can be used as a key for encoding and decoding.
SDK
Framework
protocol CodingKey
init?(int Value: Int)Creates a new instance from the specified integer.
Required.
init?(string Value: String)Creates a new instance from the given string.
Required.
var int Value: Int?The value to use in an integer-indexed collection (e.g. an int-keyed dictionary).
Required.
var string Value: StringThe string to use in a named collection (e.g. a string-keyed dictionary).
Required.
Make your data types encodable and decodable for compatibility with external representations such as JSON.
typealias CodableA type that can convert itself into and out of an external representation.
protocol EncodableA type that can encode itself to an external representation.
protocol DecodableA type that can decode itself from an external representation.
struct Coding User Info KeyA user-defined key for providing context during encoding and decoding.