---
title: "drawAsPattern(in:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiimage/drawaspattern(in:)"
---

# drawAsPattern(in:)

Draws a tiled Quartz pattern using the receiver’s contents as the tile pattern.

## Declaration

```swift
func drawAsPattern(in rect: CGRect)
```

## Parameters

- `rect`: The rectangle (in the coordinate system of the graphics context) in which to draw the image.

## Discussion

Discussion This method uses a Quartz pattern to tile the image in the specified rectangle. The image is tiled with no gaps and the fill color is ignored. In the default coordinate system, the image tiles are situated down and to the right of the origin of the specified rectangle. This method respects any transforms applied to the current graphics context, however.

## See Also

### Drawing images

- [draw(at:)](uikit/uiimage/draw(at:).md)
- [draw(at:blendMode:alpha:)](uikit/uiimage/draw(at:blendmode:alpha:).md)
- [draw(in:)](uikit/uiimage/draw(in:).md)
- [draw(in:blendMode:alpha:)](uikit/uiimage/draw(in:blendmode:alpha:).md)
