View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vídeos

Abrir menu Fechar menu
  • Coleções
  • Todos os vídeos
  • Sobre

Mais vídeos

  • Sobre
  • Código
  • Customize spatial Persona templates in SharePlay

    Learn how to use custom spatial Persona templates in your visionOS SharePlay experience to fine-tune the placement of Personas relative to your app. We'll show you how to adopt custom spatial Persona templates in a sample app with SharePlay, move participants between seats, and test your changes in Simulator. We'll also share best practices for designing custom spatial templates that will make your experience shine.

    Capítulos

    • 0:00 - Introduction
    • 1:01 - SharePlay on visionOS
    • 4:50 - Build "Guess Together"
    • 23:41 - Play Guess Together
    • 25:13 - Design for Spatial Personas

    Recursos

    • Building a guessing game for visionOS
    • Forum: App & System Services
    • Group Activities
      • Vídeo HD
      • Vídeo SD

    Vídeos relacionados

    WWDC23

    • Build spatial SharePlay experiences

    WWDC22

    • Make a great SharePlay experience

    WWDC21

    • Build custom experiences with Group Activities
  • Buscar neste vídeo...
    • 12:32 - Initial team selection template

      // Team selection template – custom spatial template
      
      import GroupActivities
      
      struct TeamSelectionTemplate: SpatialTemplate {
          let elements: [any SpatialTemplateElement] = [
              .seat(position: .app.offsetBy(x: 0, z: 4)),
              
              .seat(position: .app.offsetBy(x: 1, z: 4)),
              .seat(position: .app.offsetBy(x: -1, z: 4)),
              
              .seat(position: .app.offsetBy(x: 2, z: 4)),
              .seat(position: .app.offsetBy(x: -2, z: 4)),
          ]
      }
    • 13:31 - Completed team selection template with seat roles

      import GroupActivities
      
      /// The custom spatial template used to arrange Spatial Personas
      /// during Guess Together's team-selection stage.
      ///
      /// The team selection template contains three sets of seats:
      ///
      /// 1. Five audience seats that participants are initially placed in.
      /// 2. Three Blue Team seats that participants are moved to
      ///    when they join team Blue.
      /// 3. Three Red Team seats.
      ///
      /// ```
      ///                ┌────────────────────┐
      ///                │   Guess Together   │
      ///                │     app window     │
      ///                └────────────────────┘
      ///
      ///
      ///              %                       $
      ///                %                   $
      ///   Blue Team      %               $      Red Team
      ///                    *  *  *  *  *
      ///
      ///                       Audience
      /// ```
      struct TeamSelectionTemplate: SpatialTemplate {
          enum Role: String, SpatialTemplateRole {
              case blueTeam
              case redTeam
          }
          
          let elements: [any SpatialTemplateElement] = [
              // Blue team:
              .seat(position: .app.offsetBy(x: -2.5, z: 3.5), role: Role.blueTeam),
              .seat(position: .app.offsetBy(x: -3.0, z: 3.0), role: Role.blueTeam),
              .seat(position: .app.offsetBy(x: -3.5, z: 2.5), role: Role.blueTeam),
              
              // Starting positions:
              .seat(position: .app.offsetBy(x: 0, z: 4)),
              .seat(position: .app.offsetBy(x: 1, z: 4)),
              .seat(position: .app.offsetBy(x: -1, z: 4)),
              .seat(position: .app.offsetBy(x: 2, z: 4)),
              .seat(position: .app.offsetBy(x: -2, z: 4)),
              
              // Red team:
              .seat(position: .app.offsetBy(x: 2.5, z: 3.5), role: Role.redTeam),
              .seat(position: .app.offsetBy(x: 3.0, z: 3.0), role: Role.redTeam),
              .seat(position: .app.offsetBy(x: 3.5, z: 2.5), role: Role.redTeam)
          ]
      }
    • 14:59 - Configuring a custom spatial template

      systemCoordinator.configuration.spatialTemplatePreference = .custom(TeamSelectionTemplate())
    • 15:39 - Assigning the local participant a spatial template role

      systemCoordinator.assignRole(TeamSelectionTemplate.Role.blueTeam)
    • 16:00 - Resigning the local participant from a spatial template role

      systemCoordinator.resignRole()
    • 17:00 - Spatial template roles

      // Associating a role with a seat
      
      .seat(position: .app.offsetBy(x: -2.5, z: 3.5), role: TeamSelectionTemplate.Role.blueTeam)
      
      // Assigning the local participant a role
      
      systemCoordinator.assignRole(TeamSelectionTemplate.Role.blueTeam)
      
      // Resigning the local participant from their current role
      
      systemCoordinator.resignRole()
    • 18:42 - Game template with seat direction

      import GroupActivities
      
      /// The custom spatial template used to arrange spatial Personas
      /// during Guess Together's game stage.
      ///
      /// The team selection template contains three sets of seats:
      ///
      /// 1. An seat to the left of the app window for the active player.
      /// 2. Two seats to the right of the app window for the active player's
      ///    teammates.
      /// 3. Five seats in front of the app window for the inactive team-members
      ///    and any audience members.
      ///
      /// ```
      ///                  ┌────────────────────┐
      ///                  │   Guess Together   │
      ///                  │     app window     │
      ///                  └────────────────────┘
      ///
      ///
      /// Active Player  %                       $  Active Team
      ///                                        $
      ///
      ///                      *  *  *  *  *
      ///
      ///                         Audience
      ///
      /// ```
      struct GameTemplate: SpatialTemplate {
          enum Role: String, SpatialTemplateRole {
              case player
              case activeTeam
          }
          
          var elements: [any SpatialTemplateElement] {
              let activeTeamCenterPosition = SpatialTemplateElementPosition.app.offsetBy(x: 2, z: 3)
      
              let playerSeat = SpatialTemplateSeatElement(
                  position: .app.offsetBy(x: -2, z: 3),
                  direction: .lookingAt(activeTeamCenterPosition),
                  role: Role.player
              )
              
              let activeTeamSeats: [any SpatialTemplateElement] = [
                  .seat(
                      position: activeTeamCenterPosition.offsetBy(x: 0, z: -0.5),
                      direction: .lookingAt(playerSeat),
                      role: Role.activeTeam
                  ),
                  .seat(
                      position: activeTeamCenterPosition.offsetBy(x: 0, z: 0.5),
                      direction: .lookingAt(playerSeat),
                      role: Role.activeTeam
                  )
              ]
              
              let audienceSeats: [any SpatialTemplateElement] = [
                  .seat(position: .app.offsetBy(x: 0, z: 5)),
                  .seat(position: .app.offsetBy(x: 1, z: 5)),
                  .seat(position: .app.offsetBy(x: -1, z: 5)),
                  .seat(position: .app.offsetBy(x: 2, z: 5)),
                  .seat(position: .app.offsetBy(x: -2, z: 5))
              ]
              
              return audienceSeats + [playerSeat] + activeTeamSeats
          }
      }
    • 21:41 - Configure group immersive space

      // Configure group immersive space
      
      for await session in GuessingActivity.sessions() {
          guard let systemCoordinator = await session.systemCoordinator else { continue }
      
          systemCoordinator.configuration.supportsGroupImmersiveSpace = true
      }
    • 30:35 - SimpleLine Template

      // SimpleLine.swift
      
      struct SimpleLine: SpatialTemplate {
      
          let elements: [any SpatialTemplateElement] = [
              .seat(position: .app.offsetBy(x:  0, z: 2)),
              .seat(position: .app.offsetBy(x:  1, z: 2)),
              .seat(position: .app.offsetBy(x: -1, z: 2)),
              .seat(position: .app.offsetBy(x:  2, z: 2)),
              .seat(position: .app.offsetBy(x: -2, z: 2))
          ]
      
      }
    • 31:35 - lookingAt Method

      // Look at a given position or seat
      .seat(
          position: teamSeatPosition,
          direction: .lookingAt(activePlayerSeat)
      )
    • 31:46 - alignedWith Method

      // Look at a given position or seat
      .seat(
          position: teamSeatPosition,
          direction: .lookingAt(activePlayerSeat)
      )
      
      // Align with a given app axis
      .seat(
          position: teamSeatPosition,
          direction: .alignedWith(appAxis: .z)
      )
    • 32:02 - rotatedBy Method

      // Look at a given position or seat
      .seat(
          position: teamSeatPosition,
          direction: .lookingAt(activePlayerSeat)
      )
      
      // Align with a given app axis
      .seat(
          position: teamSeatPosition,
          direction: .alignedWith(appAxis: .z)
      )
      
      // Rotate by a given angle
      .seat(
          position: teamSeatPosition,
          direction: .lookingAt(.app).rotatedBy(.degrees(30))
      )

Developer Footer

  • Vídeos
  • WWDC24
  • Customize spatial Persona templates in SharePlay
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines