<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "QuartzCore",
  "identifier" : "/documentation/QuartzCore/CAMetalLayer/nextDrawable()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Animation"
    ],
    "preciseIdentifier" : "c:objc(cs)CAMetalLayer(im)nextDrawable"
  },
  "title" : "nextDrawable()"
}
-->

# nextDrawable()

Waits until a Metal drawable is available, and then returns it.

```
func nextDrawable() -> (any CAMetalDrawable)?
```

## Return Value

A Metal drawable. Use the drawable’s [`texture`](/documentation/QuartzCore/CAMetalDrawable/texture) property to configure a <doc://com.apple.documentation/documentation/Metal/MTLRenderPipelineColorAttachmentDescriptor> object for rendering to the layer.

## Discussion

A [`CAMetalLayer`](/documentation/QuartzCore/CAMetalLayer) object maintains an internal pool of textures for displaying layer content, each wrapped in a [`CAMetalDrawable`](/documentation/QuartzCore/CAMetalDrawable) object. Use this method to retrieve the next available drawable from the pool. If all drawables are in use, the layer waits up to one second for one to become available, after which it returns `nil`. The [`allowsNextDrawableTimeout`](/documentation/QuartzCore/CAMetalLayer/allowsNextDrawableTimeout) property affects this behavior.

This method returns `nil` if the layer’s [`pixelFormat`](/documentation/QuartzCore/CAMetalLayer/pixelFormat) or other properties are invalid.

---

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)