---
title: GroupActivityAssociationInteraction
framework: groupactivities
role: symbol
role_heading: Class
path: groupactivities/groupactivityassociationinteraction
---

# GroupActivityAssociationInteraction

An interaction configures a view’s association with the current SharePlay group activity.

## Declaration

```swift
@MainActor @objc class GroupActivityAssociationInteraction
```

## Overview

Overview When a group of people join a SharePlay activity with their spatial Personas, the system selects a common, primary scene to arrange their spatial Personas around. This association between the group activity and a scene in your app creates a shared space for the spatial Personas to interact in; enabling participants to gesture at the associated scene and understand each other. For more information about spatial Personas and SharePlay on visionOS, see Adding spatial Persona support to an activity. By default, the system uses your scene’s activation conditions in concert with your activity’s SceneAssociationBehavior to select a primary scene to associate with the activity. You can specify a different scene or dynamically change the primary associated scene by adding this interaction to a view and specifying that view as the GroupActivityAssociationKind/primary group activity association. tip: When building a custom SpatialTemplate, the primary associated scene is the app that each seat’s position is relative to. To add the interaction to a view, use addInteraction(_:). // Create and store the scene association interaction private let groupActivityAssociationInteraction = GroupActivityAssociationInteraction(     associationKind: .primary("content-view") )

override func viewDidLoad() {     super.viewDidLoad()

// Add the interaction to the view     view.addInteraction(groupActivityAssociationInteraction) } If there are multiple scenes that are simultaneously configured with the primary group activity association, the most recently associated scene will be used. For example, if your app defines two windows and both contain views with the primary association kind, the most recently opened one will be used as the primary scene. If that second window is subsequently closed, the original window will be used again. You can dynamically disable the group activity association of a view by setting the optional associationKind property to nil. You can later re-associate it by setting the associationKind to .primary. func removeGroupActivityAssociation() {    groupActivityAssociationInteraction.associationKind = nil }

## Topics

### Initializers

- [init(associationKind:)](groupactivities/groupactivityassociationinteraction/init(associationkind:).md)

### Instance Properties

- [associationKind](groupactivities/groupactivityassociationinteraction/associationkind.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [UIInteraction](uikit/uiinteraction.md)

## See Also

### Spatial activities

- [Configure your visionOS app for sharing with people nearby](groupactivities/configure-your-app-for-sharing-with-people-nearby.md)
- [Adding spatial Persona support to an activity](groupactivities/adding-spatial-persona-support-to-an-activity.md)
- [SystemCoordinator](groupactivities/systemcoordinator.md)
- [SystemCoordinator.ParticipantState](groupactivities/systemcoordinator/participantstate.md)
- [groupActivityAssociation(_:)](swiftui/view/groupactivityassociation(_:).md)
- [GroupActivityAssociationKind](groupactivities/groupactivityassociationkind.md)
