---
title: "fill(using:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/sequence/fill(using:)-6sdhf"
---

# fill(using:)

Fills this list of rects in the current NSGraphicsContext with that rect’s associated gray component value in the DeviceGray color space. The compositing operation of the fill defaults to the context’s compositing operation, not necessarily using .copy like NSRectFillListWithGrays().

## Declaration

```swift
func fill(using operation: NSCompositingOperation = NSGraphicsContext.current?.compositingOperation ?? .sourceOver)
```

## Discussion

Discussion note: There must be a set current NSGraphicsContext.
