---
title: "removeCursorRect(_:cursor:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsview/removecursorrect(_:cursor:)"
---

# removeCursorRect(_:cursor:)

Completely removes a cursor rectangle from the view.

## Declaration

```swift
func removeCursorRect(_ rect: NSRect, cursor object: NSCursor)
```

## Parameters

- `rect`: A rectangle defining a region of the view. Must match a value previously specified using doc://com.apple.appkit/documentation/AppKit/NSView/addCursorRect(_:cursor:).
- `object`: An object representing a cursor. Must match a value previously specified using doc://com.apple.appkit/documentation/AppKit/NSView/addCursorRect(_:cursor:).

## Discussion

Discussion You should rarely need to use this method. The resetCursorRects() method, which is called when the cursor rectangles need to be rebuilt, should establish only the cursor rectangles needed. If you implement resetCursorRects() in this way, you can then simply modify the state that resetCursorRects() uses to build its cursor rectangles and then invoke the NSWindow method invalidateCursorRects(for:).

## See Also

### Responding to Cursor Movements

- [addCursorRect(_:cursor:)](appkit/nsview/addcursorrect(_:cursor:).md)
- [discardCursorRects()](appkit/nsview/discardcursorrects().md)
- [resetCursorRects()](appkit/nsview/resetcursorrects().md)
