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
 

Videos

Abrir menú Cerrar menú
  • Colecciones
  • Todos los videos
  • Información

Más videos

  • Información
  • Código
  • Meet TabletopKit for visionOS

    Build a board game for visionOS from scratch using TabletopKit. We'll show you how to set up your game, add powerful rendering using RealityKit, and enable multiplayer using spatial Personas in FaceTime with only a few extra lines of code.

    Capítulos

    • 0:00 - Introduction
    • 2:37 - Set up the play surface
    • 7:45 - Implement rules
    • 12:01 - Integrate RealityKit effects
    • 13:30 - Configure multiplayer

    Recursos

    • TabletopKit
    • Creating tabletop games
    • Forum: Graphics & Games
      • Video HD
      • Video SD

    Videos relacionados

    WWDC24

    • Compose interactive 3D content in Reality Composer Pro
    • Customize spatial Persona templates in SharePlay

    WWDC23

    • Add SharePlay to your app
  • Buscar este video…
    • 3:52 - Make a rectangular table

      // Make a rectangular table.
      
      let entity = try! Entity.load(named: "table", in: table_Top_KitBundle)
      let table: Tabletop = .rectangular(entity: entity)
    • 4:25 - Place seats

      // Place 3 seats around the table, facing the center.
      
      static let seatPoses: [TableVisualState.Pose2D] = [
        .init(position: .init(x: 0, y: Double(GameMetrics.tableDimensions.z)),
              rotation: .degrees(0)),
        .init(position: .init(x: -Double(GameMetrics.tableDimensions.x), y: 0),
              rotation: .degrees(-90)),
        .init(position: .init(x: Double(GameMetrics.tableDimensions.x), y: 0),
              rotation: .degrees(90))
      ]
    • 5:40 - Define player pawns

      // Define an object that describes a pawn for each player.
      
      struct PlayerPawn: EntityEquipment {
        let id: ID
        let entity: Entity
        var initialState: BaseEquipmentState
      
        init(id: ID, seat: PlayerSeat, pose: TableVisualState.Pose2D, entity: Entity) {
          self.id = id
          self.entity = entity
          initialState = .init(seatControl: .restricted([seat.id]),
                      pose: pose,
                      entity: entity)
        }
      }
    • 6:55 - Define an object that describes a tile

      // Define an object that describes a tile on the conveyor belt
      
      struct ConveyorTile: Equipment {
        enum Category: String {
          case red
          case green
          case grey
        }
         
        let id: ID
        let category: ConveyorTile.Category
        let initialState: BaseEquipmentState
      
        init(id: ID, boardID: EquipmentIdentifier, position: TableVisualState.Point2D, category: ConveyorTile.Category) {
          self.id = id
          self.category = category
          initialState = .init(parentID: boardID,
                    pose: .init(position: position, rotation: .init()),
                    boundingBox: .init(center: .zero, size: .init(x: 0.06, y: 0, z: 0.06)))
    • 9:53 - Monitor interactions

      // The view contains all the content in the game.
      
      RealityView { (content: inout RealityViewContent) in
        content.entities.append(loadedGame.renderer.root)
      }.tabletopGame(loadedGame.tabletop, parent: loadedGame.renderer.root) { _ in
        GameInteraction(game: loadedGame)
      }
      
      
      // Define an object that manages player interactions.
      
      struct GameInteraction: TabletopInteraction {
        func update(context: TabletopKit.TabletopInteractionContext, 
                      value: TabletopKit.TabletopInteractionValue) {
          switch value.phase {
            //...
        }
    • 10:48 - Respond to interaction updates

      // Respond to interaction updates.
      
      func update(context: TabletopKit.TabletopInteractionContext, 
                    value: TabletopKit.TabletopInteractionValue) {
        switch value.phase {
          //...
          case .ended: {
            guard let dst = value.proposedDestination.equipmentID else {
              return
            }
            context.addAction(.moveEquipment(matching: value.startingEquipmentID, childOf: dst))
          }
       }
    • 12:52 - Add a sound effect to the die roll

      // Respond to interaction updates.
      
        func update(context: TabletopKit.TabletopInteractionContext, 
                      value: TabletopKit.TabletopInteractionValue) {
          switch value.gesturePhase {
            //...
            case .ended: {
              if let die = game.tabletop.equipment(of: Die.self, 
                                             matching: value.startingEquipmentID) {
                if let audioLibraryComponent = die.entity.components[AudioLibraryComponent.self] {
                  if let soundResource = audioLibraryComponent.resources["dieSoundShort.mp3"] {
                    die.entity.playAudio(soundResource)
                  }
                }
              }
            }
          }
        }
    • 14:44 - Set up multiplayer with SharePlay

      // Set up multiplayer using SharePlay.
      // Provide a button to begin SharePlay.
      
      import GroupActivities
      func shareplayButton() -> some View {
        Button("SharePlay", systemImage: "shareplay") {
        Task {try! await Activity().activate() }
        }
      }
      
      
      // After joining the SharePlay session, start multiplayer.
      
          sessionTask = Task.detached { @MainActor in
            for await session in Activity.sessions() {
              tabletopGame.coordinateWithSession(session)
            }
          }

Developer Footer

  • Videos
  • WWDC24
  • Meet TabletopKit for visionOS
  • 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