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

# setFrame(_:display:animate:)

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

```
func setFrame(_ frameRect: NSRect, display displayFlag: Bool, animate animateFlag: Bool)
```

## Parameters

`frameRect`

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

`displayFlag`

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.

`animateFlag`

Specifies whether the window performs a smooth resize. <doc://com.apple.documentation/documentation/Swift/true> to perform the animation, whose duration is specified by [`animationResizeTime(_:)`](/documentation/AppKit/NSWindow/animationResizeTime(_:)).

## See Also

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

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



---

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)