---
title: Entity.ComponentSet
framework: realitykit
role: symbol
role_heading: Structure
path: realitykit/entity/componentset
---

# Entity.ComponentSet

A collection of components that an entity stores.

## Declaration

```swift
@MainActor @preconcurrency struct ComponentSet
```

## Overview

Overview A ComponentSet represents all the components that an entity holds. Use this set to add, remove, and update components on an entity. This set can hold one component of each type. Access the ComponentSet of an Entity using its components property. ComponentSet conforms to Sequence, allowing you to iterate over it to access and use each component, as the example below shows: for component in entity.components {     print(component) }

## Topics

### Updating the set

- [set(_:)](realitykit/entity/componentset/set(_:)-8sii2.md)
- [set(_:)](realitykit/entity/componentset/set(_:)-2qzsc.md)
- [remove(_:)](realitykit/entity/componentset/remove(_:).md)
- [removeAll()](realitykit/entity/componentset/removeall().md)

### Accessing members

- [subscript(_:)](realitykit/entity/componentset/subscript(_:)-5wdsf.md)
- [subscript(_:)](realitykit/entity/componentset/subscript(_:)-47rhg.md)

### Checking for membership

- [has(_:)](realitykit/entity/componentset/has(_:).md)

### Accessing components

- [subscript(componentType:)](realitykit/entity/componentset/subscript(componenttype:)-8y2jv.md)
- [subscript(_:_:)](realitykit/entity/componentset/subscript(_:_:)-404se.md)

### Accessing animatable components

- [subscript(componentType:)](realitykit/entity/componentset/subscript(componenttype:)-3miek.md)
- [subscript(_:_:)](realitykit/entity/componentset/subscript(_:_:)-b2gl.md)
- [subscript(withoutAnimation:)](realitykit/entity/componentset/subscript(withoutanimation:).md)

### Setting components by name

- [set(qualifiedComponentName:representation:)](realitykit/entity/componentset/set(qualifiedcomponentname:representation:).md)

### Instance Properties

- [count](realitykit/entity/componentset/count.md)
- [entity](realitykit/entity/componentset/entity.md)

### Instance Methods

- [set(_:)](realitykit/entity/componentset/set(_:).md)

### Subscripts

- [subscript(_:)](realitykit/entity/componentset/subscript(_:).md)
- [subscript(_:_:)](realitykit/entity/componentset/subscript(_:_:).md)
- [subscript(componentType:)](realitykit/entity/componentset/subscript(componenttype:).md)

## Relationships

### Conforms To

- [BidirectionalCollection](swift/bidirectionalcollection.md)
- [Collection](swift/collection.md)
- [Copyable](swift/copyable.md)
- [Escapable](swift/escapable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [Sequence](swift/sequence.md)

## See Also

### Managing components

- [components](realitykit/entity/components.md)
