---
title: "highlight(_:withFrame:in:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextattachmentcellprotocol/highlight(_:withframe:in:)"
---

# highlight(_:withFrame:in:)

Draws the receiver’s image with optional highlighting.

## Declaration

```swift
@MainActor func highlight(_ flag: Bool, withFrame cellFrame: NSRect, in controlView: NSView?)
```

## Parameters

- `flag`: A Boolean value that indicates whether to highlight the image. Add a highlight if the value is doc://com.apple.documentation/documentation/Swift/true.
- `cellFrame`: The frame rectangle in which to draw.
- `controlView`: The view in which to draw.

## See Also

### Related Documentation

- [highlight(_:withFrame:in:)](appkit/nscell/highlight(_:withframe:in:).md)
- [lockFocus()](appkit/nsview/lockfocus().md)

### Drawing the cell contents

- [draw(withFrame:in:)](appkit/nstextattachmentcellprotocol/draw(withframe:in:).md)
- [draw(withFrame:in:characterIndex:)](appkit/nstextattachmentcellprotocol/draw(withframe:in:characterindex:).md)
- [draw(withFrame:in:characterIndex:layoutManager:)](appkit/nstextattachmentcellprotocol/draw(withframe:in:characterindex:layoutmanager:).md)
