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

# draw(withFrame:in:)

Draws the cell’s image in the specified rectangle of the currently focused view.

## Declaration

```swift
@MainActor func draw(withFrame cellFrame: NSRect, in controlView: NSView?)
```

## Parameters

- `cellFrame`: The frame rectangle in which to draw.
- `controlView`: The view in which to draw.

## See Also

### Related Documentation

- [draw(withFrame:in:)](appkit/nscell/draw(withframe:in:).md)
- [Text Attachment Programming Topics](apple-archive/documentation/Cocoa/Conceptual/TextAttachments.md)
- [lockFocus()](appkit/nsview/lockfocus().md)

### Drawing the cell contents

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