<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIDocumentViewController/documentDidOpen()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIDocumentViewController(im)documentDidOpen"
  },
  "title" : "documentDidOpen()"
}
-->

# documentDidOpen()

Provides an opportunity to configure the view after the system loads the controller’s document into memory.

```
func documentDidOpen()
```

## Discussion

The system calls this method after the document view controller opens its document, or when an object assigns an already opened document to the document view controller’s `document` property. Override this method to customize the views that present your document in the view:

```swift
override func documentDidOpen() {
    configureViewForCurrentDocument()
}
```

Configure the view in its own method and call that method in both `documentDidOpen()` and [`viewDidLoad()`](/documentation/UIKit/UIViewController/viewDidLoad()). There is no timing guarantee between when the system calls `documentDidOpen` and when it loads the view controller’s view.

---

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)