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

# removeDocument(_:)

Removes the given document from the list of open documents.

```
func removeDocument(_ document: NSDocument)
```

## Parameters

`document`

The document to remove.

## Discussion

A document will automatically call [`removeDocument(_:)`](/documentation/AppKit/NSDocumentController/removeDocument(_:)) when it closes. This method is mostly provided for subclasses that want to know when documents 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)