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

# addChildWindow(_:ordered:)

Adds a given window as a child window of the window.

```
func addChildWindow(_ childWin: NSWindow, ordered place: NSWindow.OrderingMode)
```

## Parameters

`childWin`

The child window to order.

`place`

- [`NSWindow.OrderingMode.above`](/documentation/AppKit/NSWindow/OrderingMode/above): `childWin` is ordered immediately in front of the window.

- [`NSWindow.OrderingMode.below`](/documentation/AppKit/NSWindow/OrderingMode/below): `childWin` is ordered immediately behind the window.

## Discussion

After the `childWin` is added as a child of the window, it is maintained in relative position indicated by `place` for subsequent ordering operations involving either window. While this attachment is active, moving `childWin` will not cause the window to move (as in sliding a drawer in or out), but moving the window will cause `childWin` to move.

Note that you should not create cycles between parent and child windows. For example, you should not add window B as child of window A, then add window A as a child of window B.

---

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)