<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "StateReporting",
  "identifier" : "/documentation/StateReporting/SRStateReporter",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "StateReporting"
    ],
    "preciseIdentifier" : "c:objc(cs)SRStateReporter"
  },
  "title" : "SRStateReporter"
}
-->

# SRStateReporter

An object unique per domain that records state transitions and volatile metadata updates.

```
@interface SRStateReporter : NSObject
```

## Overview

`SRStateReporter` is the central object for recording your feature’s or subsystem’s current
state. Obtain an instance through the [`reporterForDomain:`](/documentation/StateReporting/SRStateReporter/reporterForDomain:) method, which guarantees
that every caller using the same domain string receives the same object.

A state is uniquely identified by its label and stable metadata. A transition to a new
state occurs when the label or stable metadata changes; reporting the same label and
stable metadata as the current state is a no-op. *Volatile metadata* provides additional context
within an ongoing state and is discarded when the next transition begins. Context
dictionaries must contain only `NSNumber`, `NSString`, or `NSDate` values.

Call [`reportTransitionToStateLabel:stableMetadata:volatileMetadata:`](/documentation/StateReporting/SRStateReporter/reportTransitionToStateLabel:stableMetadata:volatileMetadata:) whenever your feature
transitions to a new state. Pass `nil` as the label to signal that no state is active. Call
[`reportVolatileMetadataUpdate:`](/documentation/StateReporting/SRStateReporter/reportVolatileMetadataUpdate:) to update volatile metadata without beginning a new state
transition. Calling either method more frequently than user interaction timescales can trigger
rate limiting, causing state updates to go unlogged.

```objc
SRStateReporter *reporter =
    [SRStateReporter reporterForDomain:@"com.example.myapp.checkout"];

[reporter reportTransitionToStateLabel:@"paymentSheet"
                 stableMetadata:@{@"userTier": @"premium"}
                volatileMetadata:@{@"cartTotal": @(49.99)}];
```

For Swift, use [`StateReporter`](/documentation/StateReporting/StateReporter).

## Topics

### Instance Properties

[`@property (nonatomic, strong, readonly, nonnull) NSString * domain;`](/documentation/StateReporting/SRStateReporter/domain)

The reverse DNS-style domain name that identifies this reporter.

### Instance Methods

[`- (void) reportTransitionToStateLabel:(NSString *) stateLabel stableMetadata:(NSDictionary<NSString *,NSObject *> *) stableMetadata volatileMetadata:(NSDictionary<NSString *,NSObject *> *) volatileMetadata;`](/documentation/StateReporting/SRStateReporter/reportTransitionToStateLabel:stableMetadata:volatileMetadata:)

Reports a transition to a new state.

[`- (void) reportVolatileMetadataUpdate:(NSDictionary<NSString *,NSObject *> *) updatedMetadata;`](/documentation/StateReporting/SRStateReporter/reportVolatileMetadataUpdate:)

Updates the volatile metadata within the current state without beginning a new transition.

### Type Methods

[`+ (instancetype) reporterForDomain:(NSString *) domain;`](/documentation/StateReporting/SRStateReporter/reporterForDomain:)

Returns the reporter instance unique to the given domain name.

## Relationships

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)