<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/RenderLayer/Set",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation11RenderLayerV3SetV"
  },
  "title" : "RenderLayer.Set"
}
-->

# RenderLayer.Set

An unordered collection of unique render layers.

```
struct Set
```

## Overview

[`RenderLayer.Set`](/documentation/RealityKit/RenderLayer/Set) represents a group of layers - for example, the layers
a light illuminates ([`layers`](/documentation/RealityKit/DirectionalLightComponent/layers),
[`layers`](/documentation/RealityKit/PointLightComponent/layers), [`layers`](/documentation/RealityKit/SpotLightComponent/layers)) or the
layers an entity participates in ([`layers`](/documentation/RealityKit/RenderLayerComponent/layers)).

Create a [`RenderLayer.Set`](/documentation/RealityKit/RenderLayer/Set) using an array literal:

```swift
let layers: RenderLayer.Set = [.defaultLayer, RenderLayer("com.myapp.hero")]
```

## Topics

### Inspecting the set

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

The number of layers in the set.

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

A Boolean value indicating whether the set contains no layers.

[`func contains(RenderLayer) -> Bool`](/documentation/RealityKit/RenderLayer/Set/contains(_:))

Returns a Boolean value indicating whether the set contains the given layer.

### Initializers

[`init()`](/documentation/RealityKit/RenderLayer/Set/init())

Creates an empty set of render layers.

[`init<S>(S)`](/documentation/RealityKit/RenderLayer/Set/init(_:))

Creates a set of render layers from a sequence.

### Instance Methods

[`func insert(RenderLayer) -> (inserted: Bool, memberAfterInsert: RenderLayer)`](/documentation/RealityKit/RenderLayer/Set/insert(_:))

Inserts the given layer into the set.

[`func remove(RenderLayer) -> RenderLayer?`](/documentation/RealityKit/RenderLayer/Set/remove(_:))

Removes the given layer from the set if it exists.

## Relationships

### Conforms To

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

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

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

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

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

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

[`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)