Class

UIDocument​Picker​View​Controller

A UIDocument​Picker​View​Controller object lets the user select documents or destinations outside your app’s sandbox. You must enable iCloud document support before you can use the document picker. For more information, see iCloud Design Guide.

Overview

Document Picker Modes

The document picker supports four modes. Each mode provides a slightly different approach to sharing files between apps.

  • Import an external document. The user selects an external document. The document picker copies the document, leaving the original unchanged.

  • Export a local document. The user selects an external destination. The document picker copies the document, leaving the original unchanged.

  • Open an external document. The user selects an external document. The document picker provides access to the document, letting the user edit the document in place.

  • Move a local document. The user selects an external destination. The document picker moves the document; however, you can still access the document as an external document, letting the user edit the document in place.

Working with External Documents

Both the open and move operations grant access to documents outside your app’s sandbox. This gives users an unprecedented amount of flexibility when it comes to working with their documents. However, it also adds a layer of complexity to your file handling. External documents have the following additional requirements:

For more information on working with external documents, see Creating an Outstanding User Experience in App Extension Programming Guide.

Symbols

Creating a Document Picker

init(document​Types:​ [String], in:​ UIDocument​Picker​Mode)

Initializes and returns a document picker that can import or open the given file types.

init(url:​ URL, in:​ UIDocument​Picker​Mode)

Initializes and returns a document picker that can export or move the given document.

Configuring a Document Picker

var delegate:​ UIDocument​Picker​Delegate?

The document picker’s delegate.

var document​Picker​Mode:​ UIDocument​Picker​Mode

The type of file-transfer operation that the document picker performs.

Constants

UIDocument​Picker​Mode

Modes that define the type of file-transfer operation used by the document picker.