<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSView/viewWillMove(toSuperview:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSView(im)viewWillMoveToSuperview:"
  },
  "title" : "viewWillMove(toSuperview:)"
}
-->

# viewWillMove(toSuperview:)

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

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

## Parameters

`newSuperview`

A view object that will be the new superview of the view.

## Discussion

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)