---
title: "open(completionHandler:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uidocument/open(completionhandler:)"
---

# open(completionHandler:)

Opens a document asynchronously.

## Declaration

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

```swift
func open() async -> Bool
```

## Parameters

- `completionHandler`: A block with code to execute after the open operation concludes. The block returns no value and has one parameter: The block is invoked on the main queue.

## Discussion

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 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 NSFileCoordinator class to implement coordinated reading. The default implementation calls 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:).

## See Also

### Reading document data

- [load(fromContents:ofType:)](uikit/uidocument/load(fromcontents:oftype:).md)
- [read(from:)](uikit/uidocument/read(from:).md)
