---
title: "willRemoveSubview(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiview/willremovesubview(_:)"
---

# willRemoveSubview(_:)

Tells the view that a subview is about to be removed.

## Declaration

```swift
func willRemoveSubview(_ subview: UIView)
```

## Parameters

- `subview`: The subview that will be removed.

## Discussion

Discussion The default implementation of this method does nothing. Subclasses can override it to perform additional actions whenever subviews are removed. This method is called when the subview’s superview changes or when the subview is removed from the view hierarchy completely.

## See Also

### Related Documentation

- [removeFromSuperview()](uikit/uiview/removefromsuperview().md)

### Observing view-related changes

- [didAddSubview(_:)](uikit/uiview/didaddsubview(_:).md)
- [willMove(toSuperview:)](uikit/uiview/willmove(tosuperview:).md)
- [didMoveToSuperview()](uikit/uiview/didmovetosuperview().md)
- [willMove(toWindow:)](uikit/uiview/willmove(towindow:).md)
- [didMoveToWindow()](uikit/uiview/didmovetowindow().md)
