<!--
{
  "availability" : [
    "macOS: 10.6.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "QuickLookUI",
  "identifier" : "/documentation/QuickLookUI/QLPreviewView/shouldCloseWithWindow",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Quick Look UI"
    ],
    "preciseIdentifier" : "c:objc(cs)QLPreviewView(py)shouldCloseWithWindow"
  },
  "title" : "shouldCloseWithWindow"
}
-->

# shouldCloseWithWindow

A Boolean value that determines whether the preview should close when its window closes.

```
var shouldCloseWithWindow: Bool { get set }
```

## Discussion

The default value of this property is <doc://com.apple.documentation/documentation/Swift/true>, which means that the preview automatically closes when its window closes. If you set this property to <doc://com.apple.documentation/documentation/Swift/false>, close the preview by calling the [`close()`](/documentation/QuickLookUI/QLPreviewView/close()) method when finished with it. Once you close a [`QLPreviewView`](/documentation/QuickLookUI/QLPreviewView), it won’t accept any more preview items.

---

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)