<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGContext/addRects(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Graphics",
      "CoreGraphics"
    ],
    "preciseIdentifier" : "s:So12CGContextRefa12CoreGraphicsE8addRectsyySaySo6CGRectVGF"
  },
  "title" : "addRects(_:)"
}
-->

# addRects(_:)

Adds a set of rectangular paths to the current path.

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

## Parameters

`rects`

An array of rectangles, specified in user space coordinates.

## Discussion

Calling this convenience method is equivalent to repeatedly calling the [`addRect(_:)`](/documentation/CoreGraphics/CGContext/addRect(_:)) method for each rectangle in the array.

---

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)