---
title: "drawerWillResizeContents(_:to:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsdrawerdelegate/drawerwillresizecontents(_:to:)"
---

# drawerWillResizeContents(_:to:)

Invoked when the user resizes the drawer or parent.

## Declaration

```swift
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

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

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.
