Class

UIDocumentBrowserViewController

A view controller for browsing and performing actions on documents stored locally and in the cloud.

Declaration

@interface UIDocumentBrowserViewController : UIViewController

Overview

With the document browser view controller, users can browse through and access their documents. By default, the document browser can access both the system’s local file provider and its iCloud file provider.

A screenshot of the document browser.

The local file provider grants access to all the documents in the app’s Documents directory. Users can also access documents from another app’s Documents directory, if that app declares either the UISupportsDocumentBrowser key, or both the UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace keys in its Info.plist file. When the user opens a document from another app's Documents directory, they're editing the document in place. The changes are saved to the other app's Documents directory.

The iCloud file provider creates a folder for your app in the user’s iCloud Drive. Users can access documents from this folder, or from anywhere in their iCloud Drive. The system automatically handles access to iCloud for you; you don't need to enable your app’s iCloud capabilities.

Third-party storage services can also provide access to the documents they manage by implementing a File Provider extension (iOS 11 or later). For more information, see FileProvider.

Topics

Creating a Document Browser

Adding a Document Browser to Your App

Give users access to their local or remote documents from within your app.

- initForOpeningFilesWithContentTypes:

Initializes and returns a document browser view controller that can open the given file types.

Responding to Browser Events

delegate

The document browser's delegate.

UIDocumentBrowserViewControllerDelegate

The protocol you implement to respond as the user interacts with the document browser.

- importDocumentAtURL:nextToDocumentAtURL:mode:completionHandler:

Imports a document into the same location as an existing document.

Configuring a Document Browser

allowedContentTypes

The document types that the browser can open.

allowsDocumentCreation

A Boolean value that determines whether the document browser can create new documents.

allowsPickingMultipleItems

A Boolean value that determines whether the user can select and open more than one document at a time.

- revealDocumentAtURL:importIfNeeded:completion:

Reveals (and optionally imports) the document at the provided URL.

Modifying the Browser's Appearance

browserUserInterfaceStyle

The visual style used by the document browser.

UIDocumentBrowserUserInterfaceStyle

Styles that define the document browser's appearance.

additionalLeadingNavigationBarButtonItems

Additional bar button items that the document browser displays on the leading side of its navigation bar.

additionalTrailingNavigationBarButtonItems

Additional bar button items that the document browser displays on the trailing side of its navigation bar.

shouldShowFileExtensions

A Boolean value that determines whether the browser always shows file extensions.

Beta
localizedCreateDocumentActionTitle

The title for the Create Document button.

Beta
defaultDocumentAspectRatio

The aspect ratio for the Create Document button.

Beta

Adding Custom Actions

customActions

Custom document browser actions.

UIDocumentBrowserAction

A custom action that you can create and add to a document browser's Edit Menu or navigation bar.

Animating Transitions

- transitionControllerForDocumentAtURL:

Creates a transition controller that provides the standard system-loading and segue animations for the document browser.

UIDocumentBrowserTransitionController

An object that implements the standard loading and transition animations for a document browser.

- transitionControllerForDocumentURL:

Creates a transition controller that provides the standard system-loading and segue animations for the document browser.

Deprecated

Errors

UIDocumentBrowserErrorCode

The error codes for errors raised by the document browser.

UIDocumentBrowserErrorDomain

The error domain for errors raised by the document browser.

Instance Properties

Relationships

Inherits From

Conforms To

See Also

Accessing Directories

Adding a Document Browser to Your App

Give users access to their local or remote documents from within your app.

Providing Access to Directories

Use a document picker to access the content of a directory outside your app’s container.

Building a Document Browser-Based App

Use a document browser to provide access to the user’s text files.

UIDocumentPickerViewController

A view controller that provides access to documents or destinations outside your app’s sandbox.

Building an App Based on the Document Browser View Controller

Implement a custom document file format to manage user interactions with files on different cloud storage providers.

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