<!--
{
  "availability" : [
    "macOS: 26.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CompositorServices",
  "identifier" : "/documentation/CompositorServices/LayerRenderer/state-swift.property",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Compositor Services",
      "CompositorServices"
    ],
    "preciseIdentifier" : "c:@F@cp_layer_renderer_get_state"
  },
  "title" : "state"
}
-->

# state

A value that indicates whether the layer renderer is currently visible
and ready for you to draw content.

```
var state: LayerRenderer.State { get }
```

## Discussion

Use the state of the layer to determine when to start and stop your rendering loop.
When the layer is in the [`LayerRenderer.State.running`](/documentation/CompositorServices/LayerRenderer/State-swift.enum/running) state,
draw frames of content using your rendering loop.
Stop your rendering loop when the layer enters other states.
When the layer reaches the [`LayerRenderer.State.invalidated`](/documentation/CompositorServices/LayerRenderer/State-swift.enum/invalidated) state,
clean up and deallocate your render loop structures.

---

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)