---
title: "ReportableMetadataKey(_:)"
framework: statereporting
role: symbol
role_heading: Macro
path: "statereporting/reportablemetadatakey(_:)"
---

# ReportableMetadataKey(_:)

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

## Declaration

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

## Mentioned in

Getting started with StateReporting

## Overview

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. @ReportableMetadata struct SessionMetadata {     @ReportableMetadataKey("uid") var userID: String     var region: String }

## See Also

### Metadata type macros

- [ReportableMetadata()](statereporting/reportablemetadata().md)
- [ReportableMetadataIgnored()](statereporting/reportablemetadataignored().md)
