---
title: "setFrame(_:display:animate:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nswindow/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.

## Declaration

```swift
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 doc://com.apple.appkit/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 doc://com.apple.appkit/documentation/AppKit/NSWindow/animationResizeTime(_:).

## See Also

### Related Documentation

- [frameRect(forContentRect:styleMask:)](appkit/nswindow/framerect(forcontentrect:stylemask:).md)

### Sizing Windows

- [frame](appkit/nswindow/frame.md)
- [setFrameOrigin(_:)](appkit/nswindow/setframeorigin(_:).md)
- [setFrameTopLeftPoint(_:)](appkit/nswindow/setframetopleftpoint(_:).md)
- [constrainFrameRect(_:to:)](appkit/nswindow/constrainframerect(_:to:).md)
- [cascadeTopLeft(from:)](appkit/nswindow/cascadetopleft(from:).md)
- [setFrame(_:display:)](appkit/nswindow/setframe(_:display:).md)
- [animationResizeTime(_:)](appkit/nswindow/animationresizetime(_:).md)
- [aspectRatio](appkit/nswindow/aspectratio.md)
- [minSize](appkit/nswindow/minsize.md)
- [maxSize](appkit/nswindow/maxsize.md)
- [isZoomed](appkit/nswindow/iszoomed.md)
- [performZoom(_:)](appkit/nswindow/performzoom(_:).md)
- [zoom(_:)](appkit/nswindow/zoom(_:).md)
- [resizeFlags](appkit/nswindow/resizeflags.md)
- [resizeIncrements](appkit/nswindow/resizeincrements.md)
