---
title: "events(for:)"
framework: Device Activity
role: symbol
role_heading: Instance Method
platforms: [iOS 15.0+, iPadOS 15.0+, Mac Catalyst 15.0+]
path: "deviceactivity/deviceactivitycenter/events(for:)"
---

# events(for:)

Fetches the events of a device activity.

## Declaration

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

## Parameters

- `activity`: The name of the activity.

## Return Value

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

## Discussion

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.

## See Also

### Getting the Events and Schedules

- [schedule(for:)](deviceactivity/deviceactivitycenter/schedule(for:).md)
