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

# open(completionHandler:)

Opens a document asynchronously.

```
func open(completionHandler: (@Sendable (Bool) -> Void)? = nil)
```

## Parameters

`completionHandler`

A block with code to execute after the open operation concludes. The block returns no value and has one parameter:

- `success`: <doc://com.apple.documentation/documentation/Swift/true> if the open operation succeeds, otherwise <doc://com.apple.documentation/documentation/Swift/false>.

    The block is invoked on the main queue.

## Discussion

Call this method to begin the sequence of method calls that opens and reads a document asynchronously. The method obtains the file-system location of the document from the [`fileURL`](/documentation/UIKit/UIDocument/fileURL) property. After the open operation concludes, the code in `completionHandler` is executed.

You can override this method if you want custom document-opening behavior, but if you do it’s recommended that you call the superclass implementation first (`super`). If you don’t call `super`, you should use the <doc://com.apple.documentation/documentation/Foundation/NSFileCoordinator> class to implement coordinated reading. The default implementation calls [`performAsynchronousFileAccess(_:)`](/documentation/UIKit/UIDocument/performAsynchronousFileAccess(_:)) to schedule the document-reading work for execution on a background queue and then, from the dispatched block, performs file coordination. The queued task then calls [`read(from:)`](/documentation/UIKit/UIDocument/read(from:)).

---

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)