<!--
{
  "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/MeshPartCollection",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation18MeshPartCollectionV"
  },
  "title" : "MeshPartCollection"
}
-->

# MeshPartCollection

An object that holds a collection of mesh parts.

```
struct MeshPartCollection
```

## Topics

### Creating a collection

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

[`init([MeshResource.Part])`](/documentation/RealityKit/MeshPartCollection/init(_:))

### Using the collection

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

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

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

Remove a part by id.

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

Remove all the parts.

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

Update an existing part. The old part is returned.

### Instance Properties

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

Number of parts.

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

True if there are no parts.

### Subscripts

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

Read a part given its id.

## Relationships

### Conforms To

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

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

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

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

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

---

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)