Synchronizing group gameplay with TabletopKit
At a glance
| Item | Summary |
|---|---|
| Purpose | Maintain game state across multiple players in a race to capture all the coins. |
| App architecture | A Swift sample with the source-visible chain TabletopKitMini-GameApp → GameView → GroupActivityManager → GameRenderer → TabletopKit APIs. |
| Main patterns | Delegate or data-source callbacks, Actor-isolated state |
| Project style | 12 scanned source file(s) across Swift, organized around ranked entry, type, and file boundaries. |
Project structure
Source bundle/
└── TabletopKit Mini-Game/
├── TabletopKit Mini-Game/
│ ├── TabletopKitMini-GameApp.swift
│ ├── CustomAction.swift
│ ├── GameEquipment.swift
│ ├── GroupActivityManager.swift
│ ├── GameInteraction.swift
│ ├── GameObserver.swift
│ ├── GameRenderer.swift
│ ├── CustomEquipmentState.swift
│ ├── Game.swift
│ └── GameSetup.swift
└── Packages/
└── RealityKitContent/
├── Sources/
│ └── RealityKitContent/
│ └── RealityKitContent.swift
└── Package.swift
Structure observations
- Architecturally prominent files are ranked from entry points and role-named declarations; resource-only paths are omitted.
- Primary languages: Swift.
- The verified tree contains 5 project/configuration file(s) and 36 source declaration(s).
Overall architecture
flowchart LR
N1["TabletopKitMini-GameApp"]
N2["GameView"]
N3["GroupActivityManager"]
N4["GameRenderer"]
N5["TabletopKit APIs"]
N1 --> N2
N2 --> N3
N3 --> N4
N4 --> N5
Reference code
TabletopKit Mini-Game/TabletopKit Mini-Game/TabletopKitMini-GameApp.swift:16 — architecture anchor
@MainActor
@main
struct MiniGameApp: App {
// ...
}Interpretation
The arrows summarize the source-visible entry, role-named types or folders, and framework direction; when nodes come from structural folders, the sequence is a high-level interpretation rather than proof that every adjacent node calls the next. Ownership is claimed only where the next section cites a stored property or assignment. The diagram is intentionally limited to the dominant path into TabletopKit.
Ownership and state
classDiagram
ResetPlayer o-- EquipmentIdentifier : playerId
ResetPlayer *-- Int : seat
FreezePlayer o-- EquipmentIdentifier : playerId
ActivatePlayer o-- EquipmentIdentifier : playerId
Ownership evidence
TabletopKit Mini-Game/TabletopKit Mini-Game/CustomAction.swift:11 — stored dependency or nearest verified ownership anchor
struct ResetPlayer: CustomAction {
var playerId: EquipmentIdentifier
// ...
}| Owner | Object or state | Relationship | Mutation authority |
|---|---|---|---|
ResetPlayer |
EquipmentIdentifier (playerId) |
stores or receives | App/module collaborators |
ResetPlayer |
Int (seat) |
owns value state | App/module collaborators |
FreezePlayer |
EquipmentIdentifier (playerId) |
stores or receives | App/module collaborators |
ActivatePlayer |
EquipmentIdentifier (playerId) |
stores or receives | App/module collaborators |
Composition arrows indicate a source-visible construction expression or locally owned value state; aggregation means the owner stores or receives a dependency without proving exclusive lifetime ownership.
Class and protocol design
TabletopKit Mini-Game/TabletopKit Mini-Game/TabletopKitMini-GameApp.swift:17 — representative type boundary
struct MiniGameApp: App {
// ...
}| Type | Responsibility | Depends on or conforms to |
|---|---|---|
MiniGameApp |
Application entry and top-level composition | App |
GameView |
User-interface presentation and input forwarding | View |
ResetPlayer |
Owns media or timeline playback | CustomAction |
FreezePlayer |
Owns media or timeline playback | CustomAction |
ActivatePlayer |
Owns media or timeline playback | CustomAction |
Player |
Owns media or timeline playback | EntityEquipment |
GroupActivityManager |
Long-lived feature or framework coordination | Observable |
GameObserver |
Observes and relays feature changes | TabletopGame.Observer |
GameRenderer |
Owns drawing, GPU, or presentation processing | Concrete collaborators/imported frameworks |
GameToolbar |
Represents a feature value or composable behavior | ToolbarContent |
No local protocol conformance is claimed as protocol-oriented design; external framework conformances are listed only as dependencies.
Access control
| Symbol | Access | Verified effect | Likely rationale |
|---|---|---|---|
realityKitContentBundle (TabletopKit Mini-Game/Packages/RealityKitContent/Sources/RealityKitContent/RealityKitContent.swift:10) |
public |
The symbol is visible to importing modules. | Inference: make the declaration available across a module or target boundary. |
activityManager (TabletopKit Mini-Game/TabletopKit Mini-Game/TabletopKitMini-GameApp.swift:36) |
private |
Use is restricted to the lexical declaration and same-file extensions allowed by Swift. | Inference: keep state mutation or dependency lifetime inside the owning implementation. |
GameEquipment (TabletopKit Mini-Game/TabletopKit Mini-Game/GameEquipment.swift:7) |
implicit internal |
No explicit modifier means the Swift declaration is internal to the module. | Inference: app-target collaboration needs no exported library surface. |
Reference code
TabletopKit Mini-Game/Packages/RealityKitContent/Sources/RealityKitContent/RealityKitContent.swift:10 — representative boundary
public let realityKitContentBundle = Bundle.moduleSwift declarations without a modifier are internal; explicit private, fileprivate, private(set), public, or open entries above are interpreted by language semantics. Objective-C/C samples instead rely on header and implementation boundaries, which are not equivalent to Swift lexical privacy.
Logic ownership and placement
| Logic | Owning type or file | Placement rationale |
|---|---|---|
| Application entry and top-level composition | MiniGameApp |
The source’s App suffix makes this role explicit. |
| Long-lived feature or framework coordination | GroupActivityManager |
The source’s Manager suffix makes this role explicit. |
| Observes and relays feature changes | GameObserver |
The source’s Observer suffix makes this role explicit. |
| Owns media or timeline playback | ActivatePlayer, FreezePlayer, Player, ResetPlayer |
The source’s Player suffix makes this role explicit. |
| Owns drawing, GPU, or presentation processing | GameRenderer |
The source’s Renderer suffix makes this role explicit. |
| User-interface presentation and input forwarding | GameView |
The source’s View suffix makes this role explicit. |
Design patterns
| Pattern | Source evidence | Purpose or tradeoff |
|---|---|---|
| Delegate or data-source callbacks | TabletopKit Mini-Game/TabletopKit Mini-Game/GameInteraction.swift:11 |
Callback protocols invert event delivery back into the sample’s owner. |
| Actor-isolated state | TabletopKit Mini-Game/TabletopKit Mini-Game/Game.swift:40 |
Actor annotations make the concurrency ownership boundary explicit. |
Naming conventions
- Types: App: MiniGameApp; Manager: GroupActivityManager; Observer: GameObserver; Player: ActivatePlayer, FreezePlayer, Player, ResetPlayer; Renderer: GameRenderer; View: GameView.
- Protocols: no local protocol declaration in the scanned source.
- Methods:
apply,playerID,aimingSightID,bankID,stoneID,lilyPadID,logID,coinID. - Files:
TabletopKit Mini-Game/TabletopKit Mini-Game/GroupActivityManager.swift,TabletopKit Mini-Game/TabletopKit Mini-Game/GameInteraction.swift,TabletopKit Mini-Game/TabletopKit Mini-Game/GameObserver.swift,TabletopKit Mini-Game/TabletopKit Mini-Game/GameRenderer.swift,TabletopKit Mini-Game/TabletopKit Mini-Game/Game.swift,TabletopKit Mini-Game/TabletopKit Mini-Game/GameSetup.swift.
Architecture takeaways
TabletopKitMini-GameAppis the main source-visible entry or composition anchor for this sample.- Framework work reaches TabletopKit, RealityKit, SwiftUI, Spatial through a deliberately small high-level chain; the detailed API graph remains inside the cited implementation files.
- Stored-property evidence identifies lifecycle collaboration; it does not by itself prove exclusive object ownership.
- Access-control conclusions separate verified language visibility from the likely design rationale.
- The source does not justify labeling the design protocol-oriented.
Source map
| Source file | Relevant symbols |
|---|---|
TabletopKit Mini-Game/TabletopKit Mini-Game/TabletopKitMini-GameApp.swift |
MiniGameApp, GameView, GameToolbar |
TabletopKit Mini-Game/TabletopKit Mini-Game/CustomAction.swift |
ResetPlayer, FreezePlayer, ActivatePlayer, DecrementHealth, CollectCoin, ResetCoin, SinkLilyPad, ResetLilyPad |
TabletopKit Mini-Game/TabletopKit Mini-Game/GameEquipment.swift |
PlayerSeat, Table, Bank, Player, AimingSight, Stone, LilyPad, Log, MovementParams, Coin |
TabletopKit Mini-Game/TabletopKit Mini-Game/GroupActivityManager.swift |
Activity, GroupActivityManager |
TabletopKit Mini-Game/TabletopKit Mini-Game/GameInteraction.swift |
GameInteraction, PlayerInteraction, LogInteraction, LilyPadInteraction |
TabletopKit Mini-Game/TabletopKit Mini-Game/GameObserver.swift |
GameObserver |
TabletopKit Mini-Game/TabletopKit Mini-Game/GameRenderer.swift |
GameRenderer |
TabletopKit Mini-Game/TabletopKit Mini-Game/CustomEquipmentState.swift |
PlayerState, CoinState, LilyPadState |
TabletopKit Mini-Game/TabletopKit Mini-Game/Game.swift |
Game, LilyPadSinkState, PlayerStat |
TabletopKit Mini-Game/Packages/RealityKitContent/Sources/RealityKitContent/RealityKitContent.swift |
Feature implementation |