CodingKeyRepresentable
A type that can be converted to and from a coding key.
- iOS
- 15.4+
- macOS
- 12.3+
- tvOS
- 15.4+
- watchOS
- 8.5+
protocol CodingKeyRepresentable
With a CodingKeyRepresentable
type, you can losslessly convert between a custom type and a CodingKey
type.
Conforming a type to CodingKeyRepresentable
lets you opt in to encoding and decoding Dictionary
values keyed by the conforming type to and from a keyed container, rather than encoding and decoding the dictionary as an unkeyed container of alternating key-value pairs.