---
title: contentViewController
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nswindow/contentviewcontroller
---

# contentViewController

The main content view controller for the window.

## Declaration

```swift
var contentViewController: NSViewController? { get set }
```

## Discussion

Discussion The value of this property provides the content view of the window. Setting this value removes the existing value of contentView and makes the contentViewController.view the main content view for the window. By default, the value of this property is nil. The content view controller controls only the contentView object, and not the title of the window. The window title can easily be bound to the contentViewController object using code such as: [window bind:NSTitleBinding toObject:contentViewController withKeyPath:@"title" options:nil]. Setting contentViewController causes the window to resize based on the current size of the contentViewController; to restrict the size of the window, use Auto Layout (note that the value of this property is encoded in the NIB). Directly assigning a contentView value clears out the root view controller.

## See Also

### Related Documentation

- [init(contentViewController:)](appkit/nswindow/init(contentviewcontroller:).md)

### Configuring the Window’s Content

- [contentView](appkit/nswindow/contentview.md)
