Instance Method


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


optional func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL])



The document picker that called this method.


The URLs of the selected documents.


The meaning of the provided URLs varies depending on the document picker’s mode:

  • UIDocumentPickerModeImport

    The URLs refer to a copy of the selected documents. These documents are temporary files. They remain available only until your application terminates. To keep a permanent copy, move these files to a permanent location inside your sandbox.

  • UIDocumentPickerModeOpen

    The URLs refer to the selected documents.

  • UIDocumentPickerModeExportToService

    The URLs refer to new copies of the exported documents at the selected destination.

  • UIDocumentPickerModeMoveToService

    The URLs refer to the documents' new locations.

The provided URLs are security-scoped, referring to files outside your app’s sandbox. For more about working with external, security-scoped URLs, see Requirements in the Document Picker Programming Guide.

See Also

Responding to User Actions

func documentPickerWasCancelled(UIDocumentPickerViewController)

Tells the delegate that the user canceled the document picker.

func documentPicker(UIDocumentPickerViewController, didPickDocumentAt: URL)

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


Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software