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

# setNeedsDisplay(_:avoidAdditionalLayout:)

Marks the receiver as requiring display.

```
func setNeedsDisplay(_ rect: NSRect, avoidAdditionalLayout flag: Bool)
```

## Parameters

`rect`

The rectangle in which display is required.

`flag`

A value of <doc://com.apple.documentation/documentation/Swift/true> causes the receiver to not perform any layout, even if this means that portions of the text view remain empty. Otherwise the receiver performs at least as much layout as needed to display `aRect`.

## Discussion

`NSTextView` overrides the `NSView` [`setNeedsDisplay(_:)`](/documentation/AppKit/NSView/setNeedsDisplay(_:)) method to invoke this method with a `flag` argument of <doc://com.apple.documentation/documentation/Swift/false>.

---

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)