<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DeviceActivity",
  "identifier" : "/documentation/DeviceActivity/DeviceActivityReport/Context",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Device Activity",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:23_DeviceActivity_SwiftUI0aB6ReportV7ContextV"
  },
  "title" : "DeviceActivityReport.Context"
}
-->

# DeviceActivityReport.Context

A context indicating how your device activity report extension should configure its `DeviceActivityReportView`.

```
struct Context
```

## Overview

You can use a [`DeviceActivityReport.Context`](/documentation/DeviceActivity/DeviceActivityReport/Context) to create a [`DeviceActivityReport`](/documentation/DeviceActivity/DeviceActivityReport), which the system then provides to your app’s extension
and allows it to configure the resulting report `View` in a particular way. For example, if you want to render either a pie chart or bar
graph representing the user’s device activity, you can create the following custom contexts:

```
extension DeviceActivityReport.Context {
    static let barGraph = Self("barGraph")
    static let pieChart = Self("pieChart")
}
```

If your app instantiates a report with the `barGraph` context, then the system prompts your report extension to generate a
view using the `Scene` corresponding to that context.

## Topics

### Initializers

[`init(String)`](/documentation/DeviceActivity/DeviceActivityReport/Context/init(_:))

Creates a new instance with the specified raw value.

[`init(rawValue: String)`](/documentation/DeviceActivity/DeviceActivityReport/Context/init(rawValue:))

Creates a new instance with the specified raw value.

### Instance Properties

[`var rawValue: String`](/documentation/DeviceActivity/DeviceActivityReport/Context/rawValue)

The underlying value that represents the given context.

## Relationships

### Conforms To

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

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

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

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

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

---

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)