<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextView/drawInsertionPoint(in:color:turnedOn:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextView(im)drawInsertionPointInRect:color:turnedOn:"
  },
  "title" : "drawInsertionPoint(in:color:turnedOn:)"
}
-->

# drawInsertionPoint(in:color:turnedOn:)

Draws or erases the insertion point.

```
func drawInsertionPoint(in rect: NSRect, color: NSColor, turnedOn flag: Bool)
```

## Parameters

`rect`

The rectangle in which to draw the insertion point.

`color`

The color with which to draw the insertion point.

`flag`

<doc://com.apple.documentation/documentation/Swift/true> to draw the insertion point, <doc://com.apple.documentation/documentation/Swift/false> to erase it.

## Discussion

The focus must be locked on the receiver when this method is invoked. You should not need to invoke this method directly.

## See Also

[`backgroundColor`](/documentation/AppKit/NSTextView/backgroundColor)

The receiver’s background color.

[`lockFocus()`](/documentation/AppKit/NSView/lockFocus())

Locks the focus on the view, so subsequent commands take effect in the view’s window and coordinate system.

[`insertionPointColor`](/documentation/AppKit/NSTextView/insertionPointColor)

The color of the insertion point.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)