---
title: "documentBrowser(_:didPickDocumentURLs:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uidocumentbrowserviewcontrollerdelegate/documentbrowser(_:didpickdocumenturls:)"
---

# documentBrowser(_:didPickDocumentURLs:)

Tells the delegate that the user has selected one or more documents.

## Declaration

```swift
optional func documentBrowser(_ controller: UIDocumentBrowserViewController, didPickDocumentURLs documentURLs: [URL])
```

## Parameters

- `controller`: The current document browser.
- `documentURLs`: An array of URLs for the selected documents. If the document browser’s doc://com.apple.uikit/documentation/UIKit/UIDocumentBrowserViewController/allowsPickingMultipleItems property is doc://com.apple.documentation/documentation/Swift/true, the array contains one or more URLs. If doc://com.apple.documentation/documentation/Swift/false, it contains only a single URL.

## Mentioned in

Presenting selected documents

## Discussion

Discussion Implement this method to process the documents selected by the user. Typically, you create a view controller to display the selected documents, then present that view modally, like in the following example. // Did Select Documents func documentBrowser(_ controller: UIDocumentBrowserViewController,                      didPickDocumentURLs documentURLs: [URL]) {          assert(controller.allowsPickingMultipleItems == false)          assert(documentURLs.count > 0,            "*** We received an empty array of documents ***")          assert(documentURLs.count <= 1,            "*** We received more than one document ***")          guard let url = documentURLs.first else {         fatalError("*** No URL Found! ***")     }          openDocument(controller, forFileURL: url) }

private func openDocument(_ controller: UIDocumentBrowserViewController,                           forFileURL url: URL) {          let doc = // Create a UIDocument subclass for the selected URL.

let editor = // Create a view controller to edit the document.

// Optionally, set up a transition controller here...              doc.open { (success) in         guard success else {             // Handle the error here...         }                  // Present the document         controller.present(editor, animated: true, completion: nil)     } }
