---
title: "removeView(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsstackview/removeview(_:)"
---

# removeView(_:)

Removes a specified view from the stack view.

## Declaration

```swift
func removeView(_ view: NSView)
```

## Parameters

- `view`: The view you want to remove from the stack view. important: If you attempt to remove a view that is not in the stack view, the system raises an exception.

## Discussion

Discussion This method removes a view from a stack view whether the view is attached or detached. For an attached view only, you can alternatively call the removeFromSuperview() method on the view.

## See Also

### Managing Views in Gravity Areas

- [addView(_:in:)](appkit/nsstackview/addview(_:in:).md)
- [insertView(_:at:in:)](appkit/nsstackview/insertview(_:at:in:).md)
- [setViews(_:in:)](appkit/nsstackview/setviews(_:in:).md)
- [NSStackView.Gravity](appkit/nsstackview/gravity.md)
