<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIGraphicsRendererContext/fill(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIGraphicsRendererContext(im)fillRect:"
  },
  "title" : "fill(_:)"
}
-->

# fill(_:)

Paints a rectangular area with the currently selected fill color.

```
func fill(_ rect: CGRect)
```

## Parameters

`rect`

A rectangle, specified in the Core Graphics coordinate space with values in points.

## Discussion

Before calling this method, select the fill color with the [`setFill()`](/documentation/UIKit/UIColor/setFill()) method on an instance of [`UIColor`](/documentation/UIKit/UIColor).

For an example of how to use this method, see [`Creating an image with an image renderer`](/documentation/UIKit/UIGraphicsImageRenderer#Creating-an-image-with-an-image-renderer) in [`UIGraphicsImageRenderer`](/documentation/UIKit/UIGraphicsImageRenderer).

---

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)