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

# viewDidMoveToWindow()

Informs the view that it has been added to a new view hierarchy.

```
func viewDidMoveToWindow()
```

## Discussion

The default implementation does nothing; subclasses can override this method to perform whatever actions are necessary.

If the view’s [`window`](/documentation/AppKit/NSView/window) property is `nil`, that result signifies that the view was removed from its window and does not currently reside in any window.

---

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)