<!--
{
  "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/init(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation11RenderLayerVyACs12StaticStringVcfc"
  },
  "title" : "init(_:)"
}
-->

# init(_:)

Creates a custom render layer with the specified compile-time constant name.

```
init(_ rawValue: StaticString)
```

## Parameters

`rawValue`

A unique compile-time constant name for this layer.

## Discussion

Use this initializer to define reusable layer constants in an extension.
Use descriptive names with namespace prefixes such as `"com.myapp.hero"`
or `"com.myapp.background"` to avoid conflicts with other layers.

```swift
extension RenderLayer {
    static let background = RenderLayer("com.myapp.background")
}
```

To create a layer from a runtime string, use [`init(rawValue:)`](/documentation/RealityKit/RenderLayer/init(rawValue:)) instead.

> Precondition: The layer name must not be empty.

---

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)