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

# contentView

The window’s content view, the highest accessible view object in the window’s view hierarchy.

```
var contentView: NSView? { get set }
```

## Discussion

The window retains the new content view and owns it thereafter. The `view` object is resized to fit precisely within the content area of the window. You can modify the content view’s coordinate system through its bounds rectangle, but you can’t alter its frame rectangle (its size or location) directly.

Setting this property releases the old content view. If you plan to reuse it, be sure to retain it before changing the property value and to release it as appropriate when adding it to another `NSWindow` or [`NSView`](/documentation/AppKit/NSView) object.

## See Also

[`setContentSize(_:)`](/documentation/AppKit/NSWindow/setContentSize(_:))

Sets the size of the window’s content view to a given size, which is expressed in the window’s base coordinate system.



---

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)