Contents

StateReportingDomain

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

Declaration

struct StateReportingDomain

Mentioned in

Discussion

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

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

Pass a set of StateReportingDomain values to 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.

See Also

App state reporting