---
title: superview
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nsview/superview
---

# superview

The view that is the parent of the current view.

## Declaration

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

## Discussion

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(_:) 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

### Related Documentation

- [removeFromSuperview()](appkit/nsview/removefromsuperview().md)

### Getting the Related Objects

- [subviews](appkit/nsview/subviews.md)
- [window](appkit/nsview/window.md)
- [opaqueAncestor](appkit/nsview/opaqueancestor.md)
- [isDescendant(of:)](appkit/nsview/isdescendant(of:).md)
- [ancestorShared(with:)](appkit/nsview/ancestorshared(with:).md)
- [enclosingMenuItem](appkit/nsview/enclosingmenuitem.md)
- [enclosingScrollView](appkit/nsview/enclosingscrollview.md)
