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

# addRects(_:)

Adds a set of rectangular paths to the current path.

## Declaration

```swift
func addRects(_ rects: [CGRect])
```

## Parameters

- `rects`: An array of rectangles, specified in user space coordinates.

## Discussion

Discussion Calling this convenience method is equivalent to repeatedly calling the addRect(_:) method for each rectangle in the array.

## See Also

### Constructing a Current Graphics Path

- [beginPath()](coregraphics/cgcontext/beginpath().md)
- [move(to:)](coregraphics/cgcontext/move(to:).md)
- [addLine(to:)](coregraphics/cgcontext/addline(to:).md)
- [addLines(between:)](coregraphics/cgcontext/addlines(between:).md)
- [addRect(_:)](coregraphics/cgcontext/addrect(_:).md)
- [addEllipse(in:)](coregraphics/cgcontext/addellipse(in:).md)
- [addArc(center:radius:startAngle:endAngle:clockwise:)](coregraphics/cgcontext/addarc(center:radius:startangle:endangle:clockwise:).md)
- [addArc(tangent1End:tangent2End:radius:)](coregraphics/cgcontext/addarc(tangent1end:tangent2end:radius:).md)
- [addCurve(to:control1:control2:)](coregraphics/cgcontext/addcurve(to:control1:control2:).md)
- [addQuadCurve(to:control:)](coregraphics/cgcontext/addquadcurve(to:control:).md)
- [addPath(_:)](coregraphics/cgcontext/addpath(_:).md)
- [closePath()](coregraphics/cgcontext/closepath().md)
- [path](coregraphics/cgcontext/path.md)
- [replacePathWithStrokedPath()](coregraphics/cgcontext/replacepathwithstrokedpath().md)
