---
title: "drawSwatch(in:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscolor/drawswatch(in:)"
---

# drawSwatch(in:)

Draws the current color in the specified rectangle.

## Declaration

```swift
func drawSwatch(in rect: NSRect)
```

## Parameters

- `rect`: The rectangle in which to draw the color.

## Discussion

Discussion Subclasses adorn the rectangle in some manner to indicate the type of color. This method is invoked by color wells, swatches, and other user interface objects that need to display colors.

## See Also

### Drawing with colors

- [set()](appkit/nscolor/set().md)
- [setFill()](appkit/nscolor/setfill().md)
- [setStroke()](appkit/nscolor/setstroke().md)
