<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSDocument/windowForSheet",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDocument(py)windowForSheet"
  },
  "title" : "windowForSheet"
}
-->

# windowForSheet

Returns the document window to use as the parent of a document-modal sheet.

```
var windowForSheet: NSWindow? { get }
```

## Discussion

This method searches the document’s window controllers for the most suitable window to use when displaying the sheet.

The value of this property may be `nil`, in which case the sender should present an app-modal panel. The `NSDocument` implementation of this property sets the value to the window of the first window controller, or `[NSApp mainWindow]` if there are no window controllers or if the first window controller has no window.

---

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)