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

# order(_:relativeTo:)

Repositions the window’s window device in the window server’s screen list.

```
func order(_ place: NSWindow.OrderingMode, relativeTo otherWin: Int)
```

## Parameters

`place`

- [`NSWindow.OrderingMode.out`](/documentation/AppKit/NSWindow/OrderingMode/out): The window is removed from the screen list and `otherWin` is ignored.

- [`NSWindow.OrderingMode.above`](/documentation/AppKit/NSWindow/OrderingMode/above): The window is ordered immediately in front of the window whose window number is `otherWin`
- [`NSWindow.OrderingMode.below`](/documentation/AppKit/NSWindow/OrderingMode/below): The window is placed immediately behind the window represented by `otherWin`.

`otherWin`

The number of the window the window is to be placed in front of or behind. Pass `0` to place the window in front of (when `place` is `NSWindowAbove`) or behind (when `place` is `NSWindowBelow`) all other windows in its level.

## See Also

[`windowNumber`](/documentation/AppKit/NSWindow/windowNumber)

The window number of the window’s window device.

[`makeKeyAndOrderFront(_:)`](/documentation/AppKit/NSWindow/makeKeyAndOrderFront(_:))

Moves the window to the front of the screen list, within its level, and makes it the key window; that is, it shows the 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)