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

# ModelSortGroup

A group that you assign to multiple entities to tell the renderer what
order and how to render the entities in the group.

```
struct ModelSortGroup
```

## Overview

Each model sort group relates model entities to each other
so that you can define what order the renderer draws them.
Pass the same model sort group instance to each [`ModelSortGroupComponent`](/documentation/RealityKit/ModelSortGroupComponent)
whose entity you want to group, along with an order number for that
entity within the group.

```swift
let group1 = ModelSortGroup()
entityA.components.set(
    ModelSortGroupComponent(group: group1, order: 0)
)
entityB.components.set(
    ModelSortGroupComponent(group: group1, order: 1)
)
```

In the example above, the renderer draws `entityA` before `entityB`.

Each `ModelSortGroup` instance represent a unique group.

```swift
let group2 = ModelSortGroup()
entityC.components.set(
    ModelSortGroupComponent(group: group2, order: 2)
)
entityD.components.set(
    ModelSortGroupComponent(group: group2, order: 3)
)
```

In this example, `entityC` and `entityD` are in the same group as each other,
but in a different group than `entityA` and `entityB`.

## Relationships

### Conforms To

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

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

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

---

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)