<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "StateReporting",
  "identifier" : "/documentation/StateReporting/ReportableMetadataKey(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Macro",
  "symbol" : {
    "kind" : "Macro",
    "modules" : [
      "StateReporting"
    ],
    "preciseIdentifier" : "s:14StateReporting21ReportableMetadataKeyyySScfm"
  },
  "title" : "ReportableMetadataKey(_:)"
}
-->

# ReportableMetadataKey(_:)

Specifies a custom key name for a property in the generated `metadataDictionary`.

```
@attached(peer) macro ReportableMetadataKey(_ key: String)
```

## Overview

By default, property names are used as dictionary keys. Use this macro to provide
a different key name, such as for compatibility with server APIs or naming conventions.

```swift
@ReportableMetadata
struct SessionMetadata {
    @ReportableMetadataKey("uid") var userID: String
    var region: String
}
```

---

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)