---
title: "fill(_:)"
framework: coregraphics
role: symbol
role_heading: Instance Method
path: "coregraphics/cgcontext/fill(_:)-6jc4y"
---

# fill(_:)

Paints the areas contained within the provided rectangles, using the fill color in the current graphics state.

## Declaration

```swift
func fill(_ rects: [CGRect])
```

## Parameters

- `rects`: An array of rectangles, in user space coordinates.

## Discussion

Discussion The current path is cleared as a side effect of calling this function.

## See Also

### Drawing Shapes

- [clear(_:)](coregraphics/cgcontext/clear(_:).md)
- [fill(_:)](coregraphics/cgcontext/fill(_:)-7a0rk.md)
- [fillEllipse(in:)](coregraphics/cgcontext/fillellipse(in:).md)
- [stroke(_:)](coregraphics/cgcontext/stroke(_:).md)
- [stroke(_:width:)](coregraphics/cgcontext/stroke(_:width:).md)
- [strokeEllipse(in:)](coregraphics/cgcontext/strokeellipse(in:).md)
- [strokeLineSegments(between:)](coregraphics/cgcontext/strokelinesegments(between:).md)
