---
title: "draw(_:in:)"
framework: coregraphics
role: symbol
role_heading: Instance Method
path: "coregraphics/cgcontext/draw(_:in:)"
---

# draw(_:in:)

Draws the contents of a layer object into the specified rectangle.

## Declaration

```swift
func draw(_ layer: CGLayer, in rect: CGRect)
```

## Parameters

- `layer`: The layer whose contents you want to draw.
- `rect`: The rectangle, in current user space coordinates, to draw in.

## Discussion

Discussion The contents are scaled, if necessary, to fit into the rectangle.

## See Also

### Drawing Core Graphics Layers

- [draw(_:at:)](coregraphics/cgcontext/draw(_:at:).md)
