---
title: CodingKeyRepresentable
framework: swift
role: symbol
role_heading: Protocol
path: swift/codingkeyrepresentable
---

# CodingKeyRepresentable

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

## Declaration

```swift
protocol CodingKeyRepresentable
```

## Overview

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.

## Topics

### Initializers

- [init(codingKey:)](swift/codingkeyrepresentable/init(codingkey:).md)

### Instance Properties

- [codingKey](swift/codingkeyrepresentable/codingkey.md)

## Relationships

### Conforming Types

- [Int](swift/int.md)
- [String](swift/string.md)

## See Also

### Custom Encoding and Decoding

- [Encoding and Decoding Custom Types](foundation/encoding-and-decoding-custom-types.md)
- [Codable](swift/codable.md)
- [Encodable](swift/encodable.md)
- [Decodable](swift/decodable.md)
- [CodingKey](swift/codingkey.md)
- [CodingUserInfoKey](swift/codinguserinfokey.md)
