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

# addRects(_:transform:)

Adds a set of rectangular subpaths to the path.

## Declaration

```swift
mutating func addRects(_ rects: [CGRect], transform: CGAffineTransform = .identity)
```

## Discussion

Discussion Calling this convenience method is equivalent to repeatedly calling the addRect(_:transform:) method for each rectangle in the array. Parameter: rects: An array of rectangles, specified in user space coordinates. transform: An affine transform to apply to the ellipse before adding to the path. Defaults to the identity transform if not specified.

## See Also

### Drawing a path

- [move(to:)](swiftui/path/move(to:).md)
- [addArc(center:radius:startAngle:endAngle:clockwise:transform:)](swiftui/path/addarc(center:radius:startangle:endangle:clockwise:transform:).md)
- [addArc(tangent1End:tangent2End:radius:transform:)](swiftui/path/addarc(tangent1end:tangent2end:radius:transform:).md)
- [addCurve(to:control1:control2:)](swiftui/path/addcurve(to:control1:control2:).md)
- [addEllipse(in:transform:)](swiftui/path/addellipse(in:transform:).md)
- [addLine(to:)](swiftui/path/addline(to:).md)
- [addLines(_:)](swiftui/path/addlines(_:).md)
- [addPath(_:transform:)](swiftui/path/addpath(_:transform:).md)
- [addQuadCurve(to:control:)](swiftui/path/addquadcurve(to:control:).md)
- [addRect(_:transform:)](swiftui/path/addrect(_:transform:).md)
- [addRelativeArc(center:radius:startAngle:delta:transform:)](swiftui/path/addrelativearc(center:radius:startangle:delta:transform:).md)
- [addRoundedRect(in:cornerSize:style:transform:)](swiftui/path/addroundedrect(in:cornersize:style:transform:).md)
- [closeSubpath()](swiftui/path/closesubpath().md)
