<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetricKit",
  "identifier" : "/documentation/MetricKit/StateReportingDomain",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "MetricKit"
    ],
    "preciseIdentifier" : "s:9MetricKit20StateReportingDomainV"
  },
  "title" : "StateReportingDomain"
}
-->

# StateReportingDomain

A value that identifies a reporting scope for segmenting metric data.

```
struct StateReportingDomain
```

## Discussion

`StateReportingDomain` is `RawRepresentable` and `ExpressibleByStringLiteral`, so create values using string literals. Use reverse DNS notation to avoid naming collisions:

```swift
let manager = MetricManager(
    enabledStateReportingDomains: ["com.example.app.session"]
)
```

Pass a set of `StateReportingDomain` values to [`init(enabledStateReportingDomains:)`](/documentation/MetricKit/MetricManager/init(enabledStateReportingDomains:)) to receive metrics segmented by each domain’s recorded states. Use `StateReporter.reporter(for:stableMetadata:)` from the `StateReporting` framework to obtain a `StateReporter`. Call `reportTransition(to:stableMetadata:)` on it to emit state transitions for MetricKit to aggregate.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`CodingKeyRepresentable`](/documentation/Swift/CodingKeyRepresentable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Escapable`](/documentation/Swift/Escapable)

[`Copyable`](/documentation/Swift/Copyable)

[`ExpressibleByUnicodeScalarLiteral`](/documentation/Swift/ExpressibleByUnicodeScalarLiteral)

[`Equatable`](/documentation/Swift/Equatable)

[`Decodable`](/documentation/Swift/Decodable)

[`Sendable`](/documentation/Swift/Sendable)

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

[`ExpressibleByStringLiteral`](/documentation/Swift/ExpressibleByStringLiteral)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`ExpressibleByExtendedGraphemeClusterLiteral`](/documentation/Swift/ExpressibleByExtendedGraphemeClusterLiteral)

[`Encodable`](/documentation/Swift/Encodable)

---

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)