A named identifier for a group of meshes and lights.
Use a ``RenderLayer`` to associate a light with the entities it should illuminate,
or to mark which entities a light affects. Every entity belongs to ``RenderLayer/defaultLayer``
unless its ``RenderLayerComponent`` specifies otherwise.
Define your own layers as static constants in an extension so they're easy to reuse:
```swift
extension RenderLayer {
static let hero = RenderLayer("com.myapp.hero")
static let background = RenderLayer("com.myapp.background")
}
```
Members (4)
get · iOS 27.0+
defaultLayer
TypeScript
static get defaultLayer(): RenderLayer
Swift declaration
static var defaultLayer: RenderLayer { get }
The default layer.
Entities without a ``RenderLayerComponent`` belong to this layer. Lights
illuminate only this layer unless their `layers` set is changed.
get
description
TypeScript
get description(): string
Swift declaration
var description: String { get }
A textual representation of this instance.
Calling this property directly is discouraged. Instead, convert an
instance of any type to a string by using the `String(describing:)`
initializer. This initializer works with any type, and uses the custom
`description` property for types that conform to
`CustomStringConvertible`:
struct Point: CustomStringConvertible {
let x: Int, y: Int
var description: String {
return "(\(x), \(y))"
}
}
let p = Point(x: 21, y: 30)
let s = String(describing: p)
print(s)
// Prints "(21, 30)"
The conversion of `p` to a string in the assignment to `s` uses the
`Point` type's `description` property.
Creates a custom render layer with the specified runtime name.
Use this failable initializer when the layer name comes from a runtime
string, such as user input or data loaded from a file. To define a layer
constant from a string literal, use ``RenderLayer/init(_:)`` instead.
Use descriptive names with namespace prefixes such as `"com.myapp.hero"`
or `"com.myapp.background"` to avoid conflicts with other layers.
- Parameter rawValue: A unique name for this layer.
- Returns: A new render layer, or `nil` if `rawValue` is empty.
init · iOS 27.0+
init
TypeScript
static init(rawValue: SDKHandle): RenderLayer
Swift declaration
init(_ rawValue: StaticString)
Creates a custom render layer with the specified compile-time constant name.
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 ``RenderLayer/init(rawValue:)`` instead.
- Parameter rawValue: A unique compile-time constant name for this layer.
- Precondition: The layer name must not be empty.