Contents

GroupActivity

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

Declaration

protocol GroupActivity : Decodable, Encodable

Mentioned in

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.

Topics

Specifying the activity details

Starting an activity immediately

Receiving an activity-related session

Transferring data types

See Also

Activity definition