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

# superview

The view that is the parent of the current view.

```
unowned(unsafe) var superview: NSView? { get }
```

## Discussion

The superview is the immediate ancestor of the current view. The value of this property is `nil` when the view is not installed in a view hierarchy. To set the value of this property, use the [`addSubview(_:)`](/documentation/AppKit/NSView/addSubview(_:)) method to embed the current view inside another view.

When checking the value of this property iteratively or recursively, be sure to compare the superview object to the content view of the window to avoid proceeding out of the view hierarchy.

## See Also

[`-  removeFromSuperview`](/documentation/AppKit/NSView/removeFromSuperview())

Unlinks the view from its superview and its window, removes it from the responder chain, and invalidates its cursor rectangles.



---

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)