<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/MeshModelCollection",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation19MeshModelCollectionV"
  },
  "title" : "MeshModelCollection"
}
-->

# MeshModelCollection

An object that holds a collection of mesh models.

```
struct MeshModelCollection
```

## Topics

### Creating a collection

[`init()`](/documentation/RealityKit/MeshModelCollection/init())

[`init([MeshResource.Model])`](/documentation/RealityKit/MeshModelCollection/init(_:))

### Using the collection

[`func insert(MeshResource.Model) -> Bool`](/documentation/RealityKit/MeshModelCollection/insert(_:))

Add a new model to the container. Returns true if added. Returns false if it already exists.

[`func remove(id: String) -> MeshResource.Model?`](/documentation/RealityKit/MeshModelCollection/remove(id:))

Remove a model by id.

[`func removeAll()`](/documentation/RealityKit/MeshModelCollection/removeAll())

Remove all the models.

[`func update(MeshResource.Model) -> MeshResource.Model?`](/documentation/RealityKit/MeshModelCollection/update(_:))

Update an existing model. The old model is returned.

[`subscript(String) -> MeshResource.Model?`](/documentation/RealityKit/MeshModelCollection/subscript(_:))

Read a model given its id.

### Instance Properties

[`var count: Int`](/documentation/RealityKit/MeshModelCollection/count)

Number of models.

[`var isEmpty: Bool`](/documentation/RealityKit/MeshModelCollection/isEmpty)

True if there are no models.

## Relationships

### Conforms To

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

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

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

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

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

---

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)