<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/Entity/ChildCollection",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation6EntityC15ChildCollectionV"
  },
  "title" : "Entity.ChildCollection"
}
-->

# Entity.ChildCollection

A collection of child entities.

```
@MainActor @preconcurrency struct ChildCollection
```

## Topics

### Accessing collection members

[`subscript(Int) -> Entity`](/documentation/RealityKit/Entity/ChildCollection/subscript(_:))

Accesses the element at the specified position. (See `Collection.subscript`.)

### Adding entities

[`func append<S>(contentsOf: S, preservingWorldTransforms: Bool)`](/documentation/RealityKit/Entity/ChildCollection/append(contentsOf:preservingWorldTransforms:)-7g61)

Adds the specified list of entity as children to this entity.

[`func append(Entity, preservingWorldTransform: Bool)`](/documentation/RealityKit/Entity/ChildCollection/append(_:preservingWorldTransform:))

Adds the specified entity as a child to this entity.

[`func append(contentsOf: [Entity], preservingWorldTransforms: Bool)`](/documentation/RealityKit/Entity/ChildCollection/append(contentsOf:preservingWorldTransforms:)-7p4hd)

Adds the specified list of entity as children to this entity.

### Removing entities

[`func remove(Entity, preservingWorldTransform: Bool)`](/documentation/RealityKit/Entity/ChildCollection/remove(_:preservingWorldTransform:))

Removes the specified child from this entity.

[`func remove(at: Int, preservingWorldTransform: Bool)`](/documentation/RealityKit/Entity/ChildCollection/remove(at:preservingWorldTransform:))

Removes the specified child from this entity.

[`func removeAll(preservingWorldTransforms: Bool)`](/documentation/RealityKit/Entity/ChildCollection/removeAll(preservingWorldTransforms:))

[`func removeAll(keepCapacity: Bool, preservingWorldTransforms: Bool)`](/documentation/RealityKit/Entity/ChildCollection/removeAll(keepCapacity:preservingWorldTransforms:))

Removes all children from this entity.

### Replacing entities

[`func replaceAll([Entity], preservingWorldTransforms: Bool)`](/documentation/RealityKit/Entity/ChildCollection/replaceAll(_:preservingWorldTransforms:)-4mgff)

Removes all children from this entity and adds the specified list of entities as the new
children.

[`func replaceAll<S>(S, preservingWorldTransforms: Bool)`](/documentation/RealityKit/Entity/ChildCollection/replaceAll(_:preservingWorldTransforms:)-1vwk4)

Removes all children from this entity and adds the specified list of entities as the new
children.

### Iterating over collection of entities

[`struct IndexingIterator`](/documentation/RealityKit/Entity/ChildCollection/IndexingIterator)

### Transforming entities

### Reordering entities

### Describing a collection

[`var description: String`](/documentation/RealityKit/Entity/ChildCollection/description)

A textual representation of this instance. (See `CustomStringConvertible`.)

### Counting entities

### Excluding entities

### Manipulating indices

[`var startIndex: Int`](/documentation/RealityKit/Entity/ChildCollection/startIndex)

The position of the first element in a nonempty collection. (See `Collection.startIndex`.)

[`var endIndex: Int`](/documentation/RealityKit/Entity/ChildCollection/endIndex)

TThe collection’s “past the end” position—that is, the position one greater than the
last valid subscript argument. (See `Collection.endIndex`.)

[`func index(after: Int) -> Int`](/documentation/RealityKit/Entity/ChildCollection/index(after:))

Returns the position immediately after the given index. (See `Collection.index`.)

### Instance Methods

[`func append(contentsOf:preservingWorldTransforms:)`](/documentation/RealityKit/Entity/ChildCollection/append(contentsOf:preservingWorldTransforms:))

Adds the specified list of entity as children to this entity.

[`func replaceAll(_:preservingWorldTransforms:)`](/documentation/RealityKit/Entity/ChildCollection/replaceAll(_:preservingWorldTransforms:))

Removes all children from this entity and adds the specified list of entities as the new
children.

### Default Implementations

[CustomStringConvertible Implementations](/documentation/RealityKit/Entity/ChildCollection/CustomStringConvertible-Implementations)

[EntityCollection Implementations](/documentation/RealityKit/Entity/ChildCollection/EntityCollection-Implementations)

## Relationships

### Conforms To

[`Copyable`](/documentation/Swift/Copyable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sequence`](/documentation/Swift/Sequence)

[`Escapable`](/documentation/Swift/Escapable)

[`Sendable`](/documentation/Swift/Sendable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`EntityCollection`](/documentation/RealityKit/EntityCollection)

[`Collection`](/documentation/Swift/Collection)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)