<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIDocumentBrowserViewController/revealDocument(at:importIfNeeded:completion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIDocumentBrowserViewController(im)revealDocumentAtURL:importIfNeeded:completion:"
  },
  "title" : "revealDocument(at:importIfNeeded:completion:)"
}
-->

# revealDocument(at:importIfNeeded:completion:)

Reveals, and optionally imports, the document at the provided URL.

```
func revealDocument(at url: URL, importIfNeeded: Bool, completion: ((URL?, (any Error)?) -> Void)? = nil)
```

## Parameters

`url`

The URL of the document to reveal.

`importIfNeeded`

A Boolean value that determines whether the document browser should import the document.

`completion`

A completion block with the following parameters:

- url: The new URL of an imported document. Set to `nil` if `shouldImport` is <doc://com.apple.documentation/documentation/Swift/false>, or if an error occurs.
- error: If an error occurs, this parameter contains the error information; otherwise, set to `nil`.

## Discussion

Call this method to display a document in the document browser.

If `importIfNeeded` is <doc://com.apple.documentation/documentation/Swift/true>, the document browser calls its delegate’s [`documentBrowser(_:didImportDocumentAt:toDestinationURL:)`](/documentation/UIKit/UIDocumentBrowserViewControllerDelegate/documentBrowser(_:didImportDocumentAt:toDestinationURL:)) method (or its [`documentBrowser(_:failedToImportDocumentAt:error:)`](/documentation/UIKit/UIDocumentBrowserViewControllerDelegate/documentBrowser(_:failedToImportDocumentAt:error:)) method, if an error occurred) before calling the completion handler.

---

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)