---
title: TableSetup
framework: tabletopkit
role: symbol
role_heading: Structure
path: tabletopkit/tablesetup
---

# TableSetup

An object that represents the arrangement of seats, equipment, and counters around the game table.

## Declaration

```swift
struct TableSetup
```

## Overview

Overview To create a TableSetup object, pass an object that conforms to the Tabletop or EntityTabletop protocol to the init(tabletop:) initializer. For example, implement a Table structure that conforms to the EntityTabletop protocol and pass an instance of it to the initializer. let table = Table() root = createRootEntity(table: table.entity) var setup = TableSetup(tabletop: table) Set the protocol properties, such as shape, entity, and id properties for the EntityTabletop protocol, in the initializer. struct Table: EntityTabletop {     var shape: TabletopShape     var entity: Entity     var id: EquipmentIdentifier          init() {         self.entity = try! Entity.load(named: "table/table", in: contentBundle)         self.shape = .round(entity: entity)         self.id = .table     } } Then add seats, equipment, and counters to the TableSetup object. To represent seats, create structures that conform to a seat protocol. To render seats using RealityKit, conform to the EntityTableSeat protocol and use the add(seat:) or a similar method to add seats. Otherwise, conform to the TableSeat protocol and use the add(seat:) or a similar method to add seats. setup.add(seat: Seat(index: 0, position: .init(x: 0, z: -0.5))) setup.add(seat: Seat(index: 1, position: .init(x: 0, z: +0.5))) To represent equipment, create structures that conform to an equipment protocol. To render equipment using RealityKit, conform to the EntityEquipment protocol and use the add(equipment:) or a similar method to add equipment. Otherwise, conform to the Equipment protocol and use the add(equipment:) or a similar method to add equipment. setup.add(equipment: Piece(position: .init(x: 0, z: 0.1))) setup.add(equipment: Card(index: 0, faceUp: true, position: .init(x: -0.1, z: 0))) setup.add(equipment: Card(index: 1, faceUp: true, position: .init(x: +0.1, z: 0))) setup.add(equipment: Die(index: 0, position: .init(x: 0, z: 0.2))) Some equipment can represent a group, such as a player’s hand in a card game. To organize equipment hierarchically, set the parentID property of the State property during gameplay. In your equipment structure implementation, you can override the layoutChildren(for:visualState:) method to lay out the containing equipment. Optionally, add one or more ScoreCounter objects to the TableSetup object to keep score of the game. Use either the add(counter:) or add(counters:) method to add score counters. Finally, create the TabletopGame instance from the TableSetup object by passing it to the init(tableSetup:version:) initializer. game = TabletopGame(tableSetup: setup)

## Topics

### Creating a setup object from a table

- [init(tabletop:)](tabletopkit/tablesetup/init(tabletop:)-4cfut.md)
- [init(tabletop:)](tabletopkit/tablesetup/init(tabletop:)-7ima6.md)

### Adding seats to place players

- [add(seat:)](tabletopkit/tablesetup/add(seat:)-a9qw.md)
- [add(seat:)](tabletopkit/tablesetup/add(seat:)-4alrc.md)
- [add(seats:)](tabletopkit/tablesetup/add(seats:)-4068d.md)
- [add(seats:)](tabletopkit/tablesetup/add(seats:)-4asnu.md)

### Adding equipment for gameplay

- [add(equipment:)](tabletopkit/tablesetup/add(equipment:)-29pef.md)
- [add(equipment:)](tabletopkit/tablesetup/add(equipment:)-294gb.md)
- [add(equipment:)](tabletopkit/tablesetup/add(equipment:)-24tv6.md)
- [add(equipment:)](tabletopkit/tablesetup/add(equipment:)-7qwj2.md)
- [add(equipment:)](tabletopkit/tablesetup/add(equipment:)-4k6m6.md)
- [add(equipment:)](tabletopkit/tablesetup/add(equipment:)-3d7h9.md)
- [add(equipment:)](tabletopkit/tablesetup/add(equipment:)-9syh2.md)
- [add(equipment:)](tabletopkit/tablesetup/add(equipment:)-9h887.md)

### Adding counters to keep score

- [add(counter:)](tabletopkit/tablesetup/add(counter:).md)
- [add(counters:)](tabletopkit/tablesetup/add(counters:).md)

### Registering an action

- [register(action:)](tabletopkit/tablesetup/register(action:).md)

## See Also

### Essentials

- [Creating tabletop games](tabletopkit/creating-tabletop-games.md)
- [Synchronizing group gameplay with TabletopKit](tabletopkit/synchronizing-group-gameplay-with-tabletopkit.md)
- [TabletopGame](tabletopkit/tabletopgame.md)
- [Tabletop](tabletopkit/tabletop.md)
- [EntityTabletop](tabletopkit/entitytabletop.md)
- [TabletopShape](tabletopkit/tabletopshape.md)
