<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSView/setNeedsDisplay(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSView(im)setNeedsDisplayInRect:"
  },
  "title" : "setNeedsDisplay(_:)"
}
-->

# setNeedsDisplay(_:)

Marks the region of the view within the specified rectangle as needing display, increasing the view’s existing invalid region to include it.

```
func setNeedsDisplay(_ invalidRect: NSRect)
```

## Parameters

`invalidRect`

The rectangular region of the view to mark as invalid; it should be specified in the coordinate system of the view.

## Discussion

A later `displayIfNeeded` method will then perform drawing only within the invalid region. View objects marked as needing display are automatically redisplayed on each pass through the application’s event loop. (View objects that need to redisplay before the event loop comes around can of course immediately be sent the appropriate `display` method.)

---

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)