<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/EntityCollection/replaceAll(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation16EntityCollectionP10replaceAllyyqd__STRd__AA0C0C7ElementRcd__lF"
  },
  "title" : "replaceAll(_:)"
}
-->

# replaceAll(_:)

Replaces all entities in this collection with those from the given
sequence.

```
mutating func replaceAll<S>(_ entities: S) where S : Sequence, S.Element : Entity
```

## Parameters

`entities`

The sequence of entities that will replace
the collection’s current contents.

## Discussion> Note: This operation might not maintain the new entities’ index order.

---

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)