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

# popoverShouldClose(_:)

Allows a delegate to override a close request.

```
@MainActor optional func popoverShouldClose(_ popover: NSPopover) -> Bool
```

## Parameters

`popover`

The popover.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the popover should close, <doc://com.apple.documentation/documentation/Swift/false> otherwise.

## Discussion

The popover invokes this method on its delegate whenever it is about to close. This gives the delegate a chance to override the close.

If there is no delegate or the delegate does not implement this method the default behavior is that the popover will close.

---

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)