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

# draw(in:)

Draws the layer’s content using the specified graphics context.

```
func draw(in ctx: CGContext)
```

## Parameters

`ctx`

The graphics context in which to draw the content. The context may be clipped to protect valid layer content. Subclasses that wish to find the actual region to draw can call <doc://com.apple.documentation/documentation/CoreGraphics/CGContext/boundingBoxOfClipPath>.

## Discussion

The default implementation of this method does not do any drawing itself. If the layer’s delegate implements the  [`draw(_:in:)`](/documentation/QuartzCore/CALayerDelegate/draw(_:in:)) method, that method is called to do the actual drawing.

Subclasses can override this method and use it to draw the layer’s content. When drawing, all coordinates should be specified in points in the logical coordinate space.

---

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)