<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.0.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGContextAddRects",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGContextAddRects"
  },
  "title" : "CGContextAddRects"
}
-->

# CGContextAddRects

Adds a set of rectangular paths to the current path.

```
extern void CGContextAddRects(CGContextRef c, const CGRect *rects, size_t count);
```

## Parameters

`c`

A graphics context.

`rects`

An array of rectangles, specified in user space coordinates.

`count`

The number of rectangles in the `rects` array.

## Discussion

This is a convenience function that adds an array of rectangles to a path, as if it called [`addRect(_:)`](/documentation/CoreGraphics/CGContext/addRect(_:)) for each rectangle.

---

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)