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

# display()

Displays the view and all its subviews if possible, invoking each of the `NSView` methods [`lockFocus()`](/documentation/AppKit/NSView/lockFocus()), [`draw(_:)`](/documentation/AppKit/NSView/draw(_:)), and [`unlockFocus()`](/documentation/AppKit/NSView/unlockFocus()) as necessary.

```
func display()
```

## Discussion

If the view isn’t opaque, this method backs up the view hierarchy to the first opaque ancestor, calculates the portion of the opaque ancestor covered by the view, and begins displaying from there.

## See Also

[`var canDraw: Bool`](/documentation/AppKit/NSView/canDraw)

A Boolean value indicating whether drawing commands will produce any results.

[`var visibleRect: NSRect`](/documentation/AppKit/NSView/visibleRect)

The portion of the view that isn’t clipped by its superviews.

[`var opaqueAncestor: NSView?`](/documentation/AppKit/NSView/opaqueAncestor)

The view’s closest opaque ancestor, which might be the view itself.



---

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)