---
title: "displayIfNeeded(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsview/displayifneeded(_:)"
---

# displayIfNeeded(_:)

Acts as displayIfNeeded(), confining drawing to a specified region of the view.

## Declaration

```swift
func displayIfNeeded(_ rect: NSRect)
```

## Parameters

- `rect`: A rectangle defining the region to be redrawn. It should be specified in the coordinate system of the view.

## See Also

### Invalidating the View’s Content

- [setNeedsDisplay(_:)](appkit/nsview/setneedsdisplay(_:).md)
- [needsDisplay](appkit/nsview/needsdisplay.md)
- [display()](appkit/nsview/display().md)
- [display(_:)](appkit/nsview/display(_:).md)
- [displayIgnoringOpacity(_:)](appkit/nsview/displayignoringopacity(_:).md)
- [displayIgnoringOpacity(_:in:)](appkit/nsview/displayignoringopacity(_:in:).md)
- [displayIfNeeded()](appkit/nsview/displayifneeded().md)
- [displayIfNeededIgnoringOpacity()](appkit/nsview/displayifneededignoringopacity().md)
- [displayIfNeededIgnoringOpacity(_:)](appkit/nsview/displayifneededignoringopacity(_:).md)
- [translateRectsNeedingDisplay(in:by:)](appkit/nsview/translaterectsneedingdisplay(in:by:).md)
- [isOpaque](appkit/nsview/isopaque.md)
- [viewWillDraw()](appkit/nsview/viewwilldraw().md)
