<!--
{
  "availability" : [
    "iOS: 15.4.0 -",
    "iPadOS: 15.4.0 -",
    "macCatalyst: 15.4.0 -",
    "macOS: 12.3.0 -",
    "tvOS: 15.4.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/CodingKeyRepresentable",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s22CodingKeyRepresentableP"
  },
  "title" : "CodingKeyRepresentable"
}
-->

# CodingKeyRepresentable

A type that can be converted to and from a coding key.

```
protocol CodingKeyRepresentable
```

## Overview

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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)