Skip to content
RedRimmedBox edited this page Jan 4, 2025 · 10 revisions

In swift-ecs, instances of the Entity type are treated as Entities in the ECS.

Entitys are defined using Swift structs, inheriting the characteristics of value types.

struct Entity

The Entity type cannot be instantiated directly. Instead, it is created through an instance of the Commands type and is fully managed within the World.

func createEntity(commands: Commands) {
    let entity: Entity = commands.spawn().id()
}
Clone this wiki locally