---
title: discardCursorRects()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nsview/discardcursorrects()
---

# discardCursorRects()

Invalidates all cursor rectangles set up using addCursorRect(_:cursor:).

## Declaration

```swift
func discardCursorRects()
```

## Discussion

Discussion You need never invoke this method directly; neither is it typically invoked during the invalidation of cursor rectangles.  NSWindow automatically invalidates cursor rectangles in response to invalidateCursorRects(for:) and before the view’s cursor rectangles are reestablished using resetCursorRects().  This method is invoked just before the view is removed from a window and when the view is deallocated.

## See Also

### Related Documentation

- [discardCursorRects()](appkit/nswindow/discardcursorrects().md)

### Responding to Cursor Movements

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