---
title: "viewWillMove(toSuperview:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsview/viewwillmove(tosuperview:)"
---

# viewWillMove(toSuperview:)

Informs the view that its superview is about to change to the specified superview (which may be nil).

## Declaration

```swift
func viewWillMove(toSuperview newSuperview: NSView?)
```

## Parameters

- `newSuperview`: A view object that will be the new superview of the view.

## Discussion

Discussion Subclasses can override this method to perform whatever actions are necessary.

## See Also

### Responding to View-Related Notifications

- [didAddSubview(_:)](appkit/nsview/didaddsubview(_:).md)
- [viewDidMoveToSuperview()](appkit/nsview/viewdidmovetosuperview().md)
- [viewDidMoveToWindow()](appkit/nsview/viewdidmovetowindow().md)
- [viewWillMove(toWindow:)](appkit/nsview/viewwillmove(towindow:).md)
- [willRemoveSubview(_:)](appkit/nsview/willremovesubview(_:).md)
