---
title: "drawerShouldClose(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsdrawerdelegate/drawershouldclose(_:)"
---

# drawerShouldClose(_:)

Asks the delegate if the specified drawer should close.

## Declaration

```swift
optional func drawerShouldClose(_ sender: NSDrawer) -> Bool
```

## Parameters

- `sender`: The drawer being closed.

## Return Value

Return Value true to allow the drawer to close; false to prevent it from closing.

## Discussion

Discussion This method is invoked on user-initiated attempts to close a drawer by dragging it or when the NSDrawerDelegate method is called.

## See Also

### Opening and Closing Drawers

- [drawerShouldOpen(_:)](appkit/nsdrawerdelegate/drawershouldopen(_:).md)
- [drawerWillOpen(_:)](appkit/nsdrawerdelegate/drawerwillopen(_:).md)
- [drawerDidOpen(_:)](appkit/nsdrawerdelegate/drawerdidopen(_:).md)
- [drawerWillClose(_:)](appkit/nsdrawerdelegate/drawerwillclose(_:).md)
- [drawerDidClose(_:)](appkit/nsdrawerdelegate/drawerdidclose(_:).md)
