<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Path/addRects(_:transform:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4PathV8addRects_9transformySaySo6CGRectVG_So17CGAffineTransformVtF"
  },
  "title" : "addRects(_:transform:)"
}
-->

# addRects(_:transform:)

Adds a set of rectangular subpaths to the path.

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

## 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.

---

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)