<!--
{
  "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/GroupSession",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Group Activities"
    ],
    "preciseIdentifier" : "s:15GroupActivities0A7SessionC"
  },
  "title" : "GroupSession"
}
-->

# GroupSession

A session for an in-progress activity that synchronizes content among participant devices.

```
final class GroupSession<ActivityType> where ActivityType : GroupActivity
```

## Overview

A `GroupSession` object contains details about the user’s currently selected
activity, its status, and its participants. When a participant engages in an
activity, the system binds a session to that activity for you.
You use the session object to synchronize your app’s activity-related content,
including your app’s UI.

You don’t create `GroupSession` objects directly. Instead, the system creates
sessions and makes them available to your app asynchronously.
Use the `AsyncSequence` type returned by the [`sessions()`](/documentation/GroupActivities/GroupActivity/sessions()) method
of your activity to retrieve new sessions when they become
available.

Before the system can create a session object, your app must create a `GroupActivity`
object and activate it. For information about how to configure group activities,
see [`GroupActivity`](/documentation/GroupActivities/GroupActivity).

### Start and Stop the Session

When you receive a new session object, it’s initially in the [`GroupSession.State.waiting`](/documentation/GroupActivities/GroupSession/State-swift.enum/waiting) state.
As soon as your app is ready to begin the associated activity, call the session’s
[`join()`](/documentation/GroupActivities/GroupSession/join()) method. Joining a session validates the connection and starts the
synchronization process between the current device and other participants’
devices. If your app successfully joins the session, the session transitions
to the [`GroupSession.State.joined`](/documentation/GroupActivities/GroupSession/State-swift.enum/joined) state.

When the user quits your app, or navigates away from the shared activity, call
the session’s [`leave()`](/documentation/GroupActivities/GroupSession/leave()) method. Leaving a session gracefully transitions it
to the [`GroupSession.State.invalidated(reason:)`](/documentation/GroupActivities/GroupSession/State-swift.enum/invalidated(reason:)) state, and informs the system
that the user isn’t currently engaged in the activity.

## Topics

### Getting the current session

[`GroupSession.Sessions`](/documentation/GroupActivities/GroupSession/Sessions)

An asynchronous sequence of sessions you use to manage a specific activity.

### Joining and leaving the session

[`join()`](/documentation/GroupActivities/GroupSession/join())

Starts the shared activity on the current device.

[`leave()`](/documentation/GroupActivities/GroupSession/leave())

Leaves the current activity and stops receiving synchronized data.

[`end()`](/documentation/GroupActivities/GroupSession/end())

Ends the activity for the entire group and stops the transfer
of synchronized data.

### Accessing the shared activity

[`activity`](/documentation/GroupActivities/GroupSession/activity)

The current activity associated with the session.

### Getting the session details

[`state`](/documentation/GroupActivities/GroupSession/state-swift.property)

The current state of the session.

[`GroupSession.State`](/documentation/GroupActivities/GroupSession/State-swift.enum)

The possible states of a session.

[`id`](/documentation/GroupActivities/GroupSession/id)

The unique identifier of the current session.

### Getting the participants

[`localParticipant`](/documentation/GroupActivities/GroupSession/localParticipant)

The participant on the current device.

[`activeParticipants`](/documentation/GroupActivities/GroupSession/activeParticipants)

The set of participants currently engaged in the activity.

### Getting the scene-association identifier

[`sceneSessionIdentifier`](/documentation/GroupActivities/GroupSession/sceneSessionIdentifier)

The persistent identifier of the session’s associated scene.

### Getting the participant’s attention

[`requestForegroundPresentation()`](/documentation/GroupActivities/GroupSession/requestForegroundPresentation())

Tells the system that your app needs to be in the foreground to continue an activity.

### Notifying participants of playback changes

[`showNotice(_:)`](/documentation/GroupActivities/GroupSession/showNotice(_:))

Posts an event to the system, which displays the information in
the system UI.

[`GroupSessionEvent`](/documentation/GroupActivities/GroupSessionEvent)

A session-related event that appears in the system UI.

### Publishing changes



---

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)