---
title: "willMove(toWindow:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiview/willmove(towindow:)"
---

# willMove(toWindow:)

Tells the view that its window object is about to change.

## Declaration

```swift
func willMove(toWindow newWindow: UIWindow?)
```

## Parameters

- `newWindow`: The window object that will be at the root of the receiver’s new view hierarchy. This parameter may be nil.

## Discussion

Discussion The default implementation of this method does nothing. Subclasses can override it to perform additional actions whenever the window changes.

## See Also

### Observing view-related changes

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