<!--
{
  "documentType" : "article",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/encoding-and-decoding-attributed-string-keys",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Encoding and Decoding Attributed String Keys"
}
-->

# Encoding and Decoding Attributed String Keys

Protocols adopted by attribute keys to encode or decode data.

## Topics

### Encoding and Decoding Keys

[`protocol DecodableAttributedStringKey`](/documentation/Foundation/DecodableAttributedStringKey)

A protocol that defines how an attribute key decodes its value.

[`protocol EncodableAttributedStringKey`](/documentation/Foundation/EncodableAttributedStringKey)

A protocol that defines how an attribute key encodes its value.

[`typealias CodableAttributedStringKey`](/documentation/Foundation/CodableAttributedStringKey)

A type alias used by attribute keys that are both encodable and decodable.

### Markdown Keys

[`protocol MarkdownDecodableAttributedStringKey`](/documentation/Foundation/MarkdownDecodableAttributedStringKey)

A protocol that defines how an attribute key decodes a value that corresponds to Markdown syntax.



---

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)