<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DeviceActivity",
  "identifier" : "/documentation/DeviceActivity/DeviceActivityCenter/events(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Device Activity"
    ],
    "preciseIdentifier" : "s:14DeviceActivity0aB6CenterV6events3forSDyAA0aB5EventV4NameVAGGAA0abG0V_tF"
  },
  "title" : "events(for:)"
}
-->

# events(for:)

Fetches the events of a device activity.

```
func events(for activity: DeviceActivityName) -> [DeviceActivityEvent.Name : DeviceActivityEvent]
```

## Parameters

`activity`

The name of the activity.

## Return Value

The events of the activity. The dictionary is empty if your app doesn’t monitor the activity.

## Discussion

The returned object is a static representation of the events at the time the function was called. In other
words, an `Event` fetched for a particular activity doesn’t dynamically update in response to future
changes made to that activity.

---

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)