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

# setFrame(_:display:)

Sets the origin and size of the window’s frame rectangle according to a given frame rectangle, thereby setting its position and size onscreen.

```
func setFrame(_ frameRect: NSRect, display flag: Bool)
```

## Parameters

`frameRect`

The frame rectangle for the window, including the title bar.

`flag`

Specifies whether the window redraws the views that need to be displayed. When <doc://com.apple.documentation/documentation/Swift/true> the window sends a [`displayIfNeeded()`](/documentation/AppKit/NSWindow/displayIfNeeded()) message down its view hierarchy, thus redrawing all views.

## Discussion

Note that the window server limits window position coordinates to ±16,000 and sizes to 10,000.

## See Also

[`-  setFrameFromString:`](/documentation/AppKit/NSWindow/setFrame(from:))

Sets the window’s frame rectangle from a given string representation.

[`+  frameRectForContentRect:styleMask:`](/documentation/AppKit/NSWindow/frameRect(forContentRect:styleMask:))

Returns the frame rectangle used by a window with a given content rectangle and window style.

[`-  setFrameUsingName:`](/documentation/AppKit/NSWindow/setFrameUsingName(_:))

Sets the window’s frame rectangle by reading the rectangle data stored under a given name from the defaults system.



---

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)