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

# drawerWillResizeContents(_:to:)

Invoked when the user resizes the drawer or parent.

```
optional func drawerWillResizeContents(_ sender: NSDrawer, to contentSize: NSSize) -> NSSize
```

## Parameters

`sender`

The drawer being resized.

`contentSize`

The proposed new size of the drawer.

## Return Value

The size that the drawer should be resized to. To resize to a different size, simply return the desired size from this method; to avoid resizing, return the current size.

## Discussion

The receiver’s minimum and maximum size constraints have already been applied when this method is invoked. While the user is resizing an `NSDrawer` or its parent, the delegate is sent a series of `windowWillResize` messages as the `NSDrawer` or parent window is dragged.

---

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)