---
title: "documentPicker(_:didPickDocumentAt:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uidocumentpickerdelegate/documentpicker(_:didpickdocumentat:)"
---

# documentPicker(_:didPickDocumentAt:)

Tells the delegate that the user has selected a document or a destination.

## Declaration

```swift
optional func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL)
```

## Parameters

- `controller`: The document picker that called this method.
- `url`: The URL of the selected document or destination.

## Discussion

Discussion The meaning of the provided URL varies depending on the document picker’s mode: UIDocumentPickerModeImport The URL refers to a copy of the selected document. This document is a temporary file. It remains available only until your application terminates. To keep a permanent copy, you must move this file to a permanent location inside your sandbox. UIDocumentPickerModeOpen The URL refers to the selected document. The provided URL is a security-scoped URL referring to a file outside your app’s sandbox. For more information on working with external, security-scoped URLs, see Requirements. UIDocumentPickerModeExportToService The URL refers to the new copy of the exported document at the selected destination. This URL refers to a file outside your app’s sandbox. You cannot access this copy; the URL is passed only to indicate success. UIDocumentPickerModeMoveToService The URL refers to the document’s new location. The provided URL is a security-scoped URL referring to a file outside your app’s sandbox. For more information on working with external, security-scoped URLs, see Requirements.

## See Also

### Responding to user actions

- [documentPicker(_:didPickDocumentsAt:)](uikit/uidocumentpickerdelegate/documentpicker(_:didpickdocumentsat:).md)
- [documentPickerWasCancelled(_:)](uikit/uidocumentpickerdelegate/documentpickerwascancelled(_:).md)
