---
title: ReportableMetadata()
framework: statereporting
role: symbol
role_heading: Macro
path: statereporting/reportablemetadata()
---

# ReportableMetadata()

Automatically generates ReportableMetadata conformance for a type.

## Declaration

```swift
@attached(member, names: named(metadataDictionary)) @attached(extension, conformances: ReportableMetadata) macro ReportableMetadata()
```

## Mentioned in

Getting started with StateReporting

## Overview

Overview Apply @ReportableMetadata to a struct or class to enable generation of a metadataDictionary from its stored properties. Properties with supported types (String, Int, Double, Date, Bool) are included; properties with unsupported types are silently skipped. The macro generates a metadataDictionary that maps each included property name to the corresponding ReportableMetadataValue case. Use ReportableMetadataKey(_:) to override the dictionary key for a specific property, and ReportableMetadataIgnored() to exclude a property entirely. @ReportableMetadata struct CheckoutMetadata {     var cartItemCount: Int     var promoCode: String?     @ReportableMetadataKey("ts") var timestamp: Date     @ReportableMetadataIgnored var internalToken: String }

## See Also

### Metadata type macros

- [ReportableMetadataKey(_:)](statereporting/reportablemetadatakey(_:).md)
- [ReportableMetadataIgnored()](statereporting/reportablemetadataignored().md)
