SharePlay Developer
Quick Start
- Decide whether this experience is launch-only co-location or shared state sync.
- Add the Group Activities capability and the required entitlement before you build any UI around the session.
- Define one
GroupActivityper experience and keep the payload minimal andCodable. - Load the right reference only after you know the workflow:
visionos-immersive-space.mdfor same-space immersive experiences without syncactivation-ui.mdfor activation and start-button flowREFERENCE.mdfor GroupActivities patterns and examples
- Configure
SystemCoordinatorbefore joining whenever spatial personas or immersive spaces are involved. - If the issue is app launch, test flow, simulator behavior, or signing, switch to the plugin's
build-run-debugworkflow skill.
Tracks
Launch-Only Same Space
Use this track when participants should enter the same immersive space, but you do not need live state sync yet.
- Define lightweight
GroupActivitymetadata. - Set
supportsGroupImmersiveSpace = truewhen the session should coordinate a group immersive experience. - Use
.immersiveEnvironmentBehavior(.coexist)only when the system immersive environment should remain visible. - Call
join()only after the session has been configured and the UI is ready.
Shared State Sync
Use this track when participants must share state, messages, or durable data.
- Keep session payloads minimal.
- Use
GroupSessionMessengerfor transient events. - Use
GroupSessionJournalfor durable shared objects. - Send a state snapshot when participants change so late joiners catch up.
Start Surface
Use this track when you are deciding how the user starts SharePlay.
- Use
activate()when FaceTime is active and the app should join that call. - Use
ShareLinkorGroupActivitySharingControllerwhen the user needs an explicit sharing surface. - Use
GroupActivityTransferRepresentationonly when the activity should be startable from transferable surfaces.
Load References When
| Reference | When to Use |
|-----------|-------------|
| REFERENCE.md | When you need GroupActivities-focused patterns and examples. |
| visionos-immersive-space.md | When implementing launch-only SharePlay for a visionOS immersive space. |
| activation-ui.md | When wiring the SharePlay entry point or start button flow. |
Guardrails
- Keep
GroupActivitydata small andCodable. - Store strong references to
GroupSession,GroupSessionMessenger, andGroupSessionJournal. - Configure
SystemCoordinatorbeforejoin()when using spatial coordination. - Do not treat
.immersiveEnvironmentBehavior(.coexist)as the coordination API. - Join only after the UI and local state are ready.
- Route launch, test, or debugging problems to the plugin's
build-run-debugworkflow skill instead of expanding this skill with execution steps.
Information About the Skill
Core Concepts
Activity Definition
- Use
GroupActivityto define the shareable experience and keep payloads minimal. - Provide
GroupActivity.metadatawith title, subtitle, preview image, and fallback URL. - Set
GroupActivityMetadata.typeto a matchingActivityTypevalue. - Use
GroupActivityActivationResultfromprepareForActivation()to decide activation. - Use
GroupActivityTransferRepresentationwhen starting the activity fromShareLink, a share sheet, or another transferable surface.
Session Lifecycle and Participants
- Use
GroupSessionto manage the live activity; calljoin(),leave(), orend(). - Observe
GroupSession.state,activeParticipants, andisLocallyInitiatedto drive UI. - Use
View.groupActivityAssociation(_:)andGroupActivityAssociationInteractionto tie a SwiftUI scene to the active session instead of hard-coding scene identifiers. - Call
GroupSession.requestForegroundPresentation()when the activity needs the app visible. - Use
GroupSession.postEvent(_:)for transient session-wide notices such as playback state changes (no system-levelshowNoticeAPI exists on visionOS).
Messaging and Transfer
- Use
GroupSessionMessengerfor time-sensitive messages and state changes. - Use
.reliabledelivery for critical state and.unreliablefor high-frequency updates. - Use
GroupSessionJournalfor attachments and other data objects that should remain available to current and later participants.
UI Surfaces to Start SharePlay
- Use
ShareLinkwithTransferable+GroupActivityTransferRepresentationin SwiftUI. - Use
GroupActivitySharingControllerin UIKit when no FaceTime call is active. - Use
NSItemProvider.registerGroupActivity(...)in share sheets when needed.
visionOS Spatial Coordination
- Use
SystemCoordinatorfromGroupSession.systemCoordinator(async property) for spatial layout. - Set
spatialTemplatePreferenceandsupportsGroupImmersiveSpaceonSystemCoordinator.Configurationbefore join. - Use
localParticipantStatesandremoteParticipantStatesto track poses. - Use
View.groupActivityAssociation(_:)andGroupActivityAssociationInteractionto associate a SwiftUI scene with the session instead of hard-coding scene identifiers. - On visionOS 26, iterate
SystemCoordinator.groupImmersionStyle(anAsyncSequenceofSystemCoordinator.GroupImmersionStylesvalues) to react when the group immersion style changes and align the local immersive experience with remote participants. - For immersive spaces, use
Scene.immersiveEnvironmentBehavior(.coexist)only when you want the system immersive environment to remain visible; participant co-location comes fromSystemCoordinatorconfiguration, not from the environment behavior modifier.
Reference Files
| Reference | When to Use |
| ----------------------------------------- | ------------------------------------------------------------------- |
| REFERENCE.md | When you need GroupActivities-focused patterns and examples. |
| visionos-immersive-space.md | When implementing launch-only SharePlay for a visionOS immersive space. |
| activation-ui.md | When wiring the SharePlay entry point or start button flow. |
Implementation Patterns
- Send a full state snapshot when new participants join.
- Keep UI state separate from shared game state to reduce message churn.
- Use
GroupSessionMessengerfor transient actions andGroupSessionJournalfor durable data. - Prefer AVFoundation coordinated playback for media sync.
Pitfalls and Checks
- Keep
GroupActivitydata minimal; send state changes via messenger or journal. - Store strong references to
GroupSession,GroupSessionMessenger, andGroupSessionJournal. - Join only when UI and state are ready; call
leave()on teardown. - Handle late joiners by sending the current state snapshot on
activeParticipantschange. - For visionOS group immersive space: if participants don't colocate, verify
supportsGroupImmersiveSpace, the selected spatial template, and thatSystemCoordinatoris configured beforejoin().