<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSDocumentController/shared",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDocumentController(cpy)sharedDocumentController"
  },
  "title" : "shared"
}
-->

# shared

Returns the shared `NSDocumentController` instance.

```
class var shared: NSDocumentController { get }
```

## Return Value

The shared `NSDocumentController` instance.

## Discussion

If an `NSDocumentController` instance doesn’t exist yet, it is created.

Initialization reads in the document types from the `CFBundleDocumentTypes` property list (in `Info.plist`), registers the instance for [`willPowerOffNotification`](/documentation/AppKit/NSWorkspace/willPowerOffNotification)s, and turns on the flag indicating that document user interfaces should be visible. You should always obtain your application’s `NSDocumentController` using this method.

## See Also

[`setShouldCreateUI:`](/documentation/AppKit/NSDocumentController/setShouldCreateUI:)

Sets whether the window controllers of a document should be created when the document is created.

[Developing a Document-Based App](/documentation/AppKit/developing-a-document-based-app)

Write an app that creates, manages, edits, and saves text documents.



---

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)