---
title: GroupActivity
framework: groupactivities
role: symbol
role_heading: Protocol
path: groupactivities/groupactivity
---

# GroupActivity

A type that can advertise your app’s activities to other participants.

## Declaration

```swift
protocol GroupActivity : Decodable, Encodable
```

## Mentioned in

Defining your app’s SharePlay activities Presenting SharePlay activities from your app’s UI Adding spatial Persona support to an activity Joining and managing a shared activity

## Overview

Overview Adopt the GroupActivity protocol in custom app data structures that represent your app’s shareable experiences. The protocol provides the system with the context and metadata to start an activity-related session. For example, the protocol defines the unique identity of the activity, and returns information about the activity. In addition to the protocol’s methods and properties, make sure your type includes the information you need to start the activity. When a participant accepts an activity, the system provides a copy of your activity type. You must use that type to begin the activity. For example, use it to present the appropriate UI for the activity and to load any required content. To initiate an activity, create an instance of your custom type and call its prepareForActivation() or activate() method. You might call one of these methods from a button in your app’s UI, or in response to other user actions. If activation succeeds, the system advertises the activity on the current FaceTime call. When an activity begins, the system creates a GroupSession instance for the activity and delivers it asynchronously to your app. Use the sessions() method to get the session and configure your app’s UI. important: GroupActivity types must be Codable so that the system can serialize them and send them to other participant’s devices.

## Topics

### Specifying the activity details

- [activityIdentifier](groupactivities/groupactivity/activityidentifier.md)
- [metadata](groupactivities/groupactivity/metadata.md)

### Starting an activity immediately

- [prepareForActivation()](groupactivities/groupactivity/prepareforactivation().md)
- [GroupActivityActivationResult](groupactivities/groupactivityactivationresult.md)
- [activate()](groupactivities/groupactivity/activate().md)

### Receiving an activity-related session

- [sessions()](groupactivities/groupactivity/sessions().md)
- [GroupActivity.Sessions](groupactivities/groupactivity/sessions.md)

### Transferring data types

- [transferRepresentation](groupactivities/groupactivity/transferrepresentation.md)

## Relationships

### Inherits From

- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)

## See Also

### Activity definition

- [Defining your app’s SharePlay activities](groupactivities/defining-your-apps-shareplay-activities.md)
- [Supporting coordinated media playback](avfoundation/supporting-coordinated-media-playback.md)
- [GroupActivityMetadata](groupactivities/groupactivitymetadata.md)
- [GroupActivityActivationResult](groupactivities/groupactivityactivationresult.md)
- [GroupActivityTransferRepresentation](groupactivities/groupactivitytransferrepresentation.md)
