<!--
{
  "availability" : [
    "macCatalyst: 14.0.0 -",
    "macOS: 10.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PreferencePanes",
  "identifier" : "/documentation/PreferencePanes/NSPreferencePane/mainView",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Preference Panes"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPreferencePane(py)mainView"
  },
  "title" : "mainView"
}
-->

# mainView

The main view of the preference pane.

```
var mainView: NSView { get set }
```

## Discussion

Subclasses should not need to override this unless they override [`loadMainView()`](/documentation/PreferencePanes/NSPreferencePane/loadMainView()) or [`assignMainView()`](/documentation/PreferencePanes/NSPreferencePane/assignMainView()).

---

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)