<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSWindowDelegate/windowWillResize(_:to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSWindowDelegate(im)windowWillResize:toSize:"
  },
  "title" : "windowWillResize(_:to:)"
}
-->

# windowWillResize(_:to:)

Tells the delegate that the window is being resized (whether by the user or through one of the `setFrame...` methods other than [`setFrame(_:display:)`](/documentation/AppKit/NSWindow/setFrame(_:display:))).

```
@MainActor optional func windowWillResize(_ sender: NSWindow, to frameSize: NSSize) -> NSSize
```

## Parameters

`sender`

The window being resized.

`frameSize`

The size to which the specified window is being resized.

## Return Value

A custom size to which the specified window will be resized.

## Discussion

The  `frameSize` contains the size (in screen coordinates) `sender` will be resized to. To resize to a different size, simply return the desired size from this method; to avoid resizing, return the current size. `sender`’s minimum and maximum size constraints have already been applied when this method is called.

While the user is resizing a window, the delegate is sent a series of [`windowWillResize(_:to:)`](/documentation/AppKit/NSWindowDelegate/windowWillResize(_:to:)) messages as the window’s frame continues to change size.

---

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)