Class

UIDocumentInteractionController

A document interaction controller, along with a delegate object, provides in-app support for managing user interactions with files in the local system. For example, an email program might use this class to allow the user to preview attachments and open them in other apps. Use this class to present an appropriate user interface for previewing, opening, copying, or printing a specified file.

Overview

After presenting its user interface, a document interaction controller handles all interactions needed to support file preview and menu display.

You can also use the delegate to participate in interactions occurring within the presented interface. For example, the delegate is notified when a file is about to be handed off to another application for opening. For a complete description of the methods you can implement in your delegate, see UIDocumentInteractionControllerDelegate.

Symbols

Creating the Document Interaction Controller

init(url: URL)

Creates and returns a new UIDocumentInteractionController object initialized with the specified URL.

Presenting and Dismissing a Document Preview

func presentPreview(animated: Bool)

Displays a full-screen preview of the target document.

func dismissPreview(animated: Bool)

Dismisses the currently active document preview.

Presenting and Dismissing Menus

func presentOptionsMenu(from: CGRect, in: UIView, animated: Bool)

Displays an options menu and anchors it to the specified location in the view.

func presentOptionsMenu(from: UIBarButtonItem, animated: Bool)

Displays an options menu and anchors it to the specified bar button item.

func presentOpenInMenu(from: CGRect, in: UIView, animated: Bool)

Displays a menu for opening the document and anchors that menu to the specified view.

func presentOpenInMenu(from: UIBarButtonItem, animated: Bool)

Displays a menu for opening the document and anchors that menu to the specified bar button item.

func dismissMenu(animated: Bool)

Dismisses the currently active menu.

Accessing the Target Document’s Attributes

var url: URL?

The URL identifying the target file on the local filesystem.

var uti: String?

The type of the target file.

var name: String?

The name of the target file.

var icons: [UIImage]

The images associated with the target file.

var annotation: Any?

Custom property list information for the target file.

Accessing the Controller Attributes

var gestureRecognizers: [UIGestureRecognizer]

The system-supplied gesture recognizers for presenting a document interaction controller.

var delegate: UIDocumentInteractionControllerDelegate?

The delegate you want to receive document interaction notifications.

Relationships

Inherits From