<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIManagedDocument/managedObjectContext",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIManagedDocument(py)managedObjectContext"
  },
  "title" : "managedObjectContext"
}
-->

# managedObjectContext

The document’s managed object context.

```
var managedObjectContext: NSManagedObjectContext { get }
```

## Discussion

The document automatically creates a managed object context using its persistent store coordinator.

### Special considerations

You must not use the document’s managed object context in [`writeAdditionalContent(_:to:originalContentsURL:)`](/documentation/UIKit/UIManagedDocument/writeAdditionalContent(_:to:originalContentsURL:)), or any of the asynchronous [`UIDocument`](/documentation/UIKit/UIDocument) methods.

---

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)