<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "QuartzCore",
  "identifier" : "/documentation/QuartzCore/CALayerDelegate/layerWillDraw(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Animation"
    ],
    "preciseIdentifier" : "c:objc(pl)CALayerDelegate(im)layerWillDraw:"
  },
  "title" : "layerWillDraw(_:)"
}
-->

# layerWillDraw(_:)

Notifies the delegate of an imminent draw.

```
optional func layerWillDraw(_ layer: CALayer)
```

## Parameters

`layer`

The layer whose contents will be drawn.

## Discussion

The [`layerWillDraw(_:)`](/documentation/QuartzCore/CALayerDelegate/layerWillDraw(_:)) method is called before [`draw(_:in:)`](/documentation/QuartzCore/CALayerDelegate/draw(_:in:)). You can use this method to configure any layer state affecting contents prior to [`draw(_:in:)`](/documentation/QuartzCore/CALayerDelegate/draw(_:in:)) such as [`contentsFormat`](/documentation/QuartzCore/CALayer/contentsFormat) and [`isOpaque`](/documentation/QuartzCore/CALayer/isOpaque).

> Important:
> This method is not called if the delegate implements ``doc://com.apple.quartzcore/documentation/QuartzCore/CALayerDelegate/display(_:)``.

---

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)