<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GroupActivities",
  "identifier" : "/documentation/GroupActivities/GroupActivity/sessions()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Group Activities",
      "GroupActivities"
    ],
    "preciseIdentifier" : "s:15GroupActivities0A8ActivityPAAE8sessionsAA0A7SessionC8SessionsVyx_GyFZ"
  },
  "title" : "sessions()"
}
-->

# sessions()

Returns the sessions for this activity as an asynchronous sequence.

```
static func sessions() -> Self.Sessions
```

## Return Value

An `AsyncSequence` type that contains the [`GroupSession`](/documentation/GroupActivities/GroupSession) objects
for this activity.

## Discussion

Use this method to retrieve new sessions for the current
activity. The method returns a sequence that may contain some or none
of its values when you access it. The system adds an element to the sequence
when the participant joins a new activity. It doesn’t update the sequence when
properties of an active session change. For example, it doesn’t update the
sequence when the state of the session changes.

Use a `for`-`in` loop to iterate over the values in the sequence.
Preface your loop with `await` to receive each value asynchronously
as it becomes available. To avoid blocking your code, perform the iteration
from an asynchronous task in your app. The following example shows
a typical way to call this method asynchronously:

```
async {
    for await newSession in MyActivity.sessions() {
       // Start a new activity.
    }
}
```

When a new session arrives, use it to prepare your app’s UI for the
new 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)