<!--
{
  "availability" : [
    "iOS: 3.2.0 -",
    "iPadOS: 3.2.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIDocumentInteractionController",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIDocumentInteractionController"
  },
  "title" : "UIDocumentInteractionController"
}
-->

# UIDocumentInteractionController

A view controller that previews, opens, or prints files with a file format that your app can’t handle directly.

```
@MainActor class UIDocumentInteractionController
```

## Overview

Use this class to present an appropriate user interface for previewing, opening, copying, or printing a specified file. For example, an email program might use this class to allow the user to preview attachments and open them in other apps.

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`](/documentation/UIKit/UIDocumentInteractionControllerDelegate).

## Topics

### Creating the document interaction controller

[`+  interactionControllerWithURL:`](/documentation/UIKit/UIDocumentInteractionController/init(url:)-8wb4p)

Creates a document interaction controller with the specified URL.

### Handling document-related interactions

[`delegate`](/documentation/UIKit/UIDocumentInteractionController/delegate)

The delegate you want to receive document interaction notifications.

[`UIDocumentInteractionControllerDelegate`](/documentation/UIKit/UIDocumentInteractionControllerDelegate)

A set of methods you can implement to respond to messages from a document interaction controller.

### Presenting and dismissing a document preview

[`-  presentPreviewAnimated:`](/documentation/UIKit/UIDocumentInteractionController/presentPreview(animated:))

Displays a full-screen preview of the target document.

[`-  dismissPreviewAnimated:`](/documentation/UIKit/UIDocumentInteractionController/dismissPreview(animated:))

Dismisses the currently active document preview.

### Presenting and dismissing menus

[`-  presentOptionsMenuFromRect:inView:animated:`](/documentation/UIKit/UIDocumentInteractionController/presentOptionsMenu(from:in:animated:))

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

[`-  presentOptionsMenuFromBarButtonItem:animated:`](/documentation/UIKit/UIDocumentInteractionController/presentOptionsMenu(from:animated:))

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

[`-  presentOpenInMenuFromRect:inView:animated:`](/documentation/UIKit/UIDocumentInteractionController/presentOpenInMenu(from:in:animated:))

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

[`-  presentOpenInMenuFromBarButtonItem:animated:`](/documentation/UIKit/UIDocumentInteractionController/presentOpenInMenu(from:animated:))

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

[`-  dismissMenuAnimated:`](/documentation/UIKit/UIDocumentInteractionController/dismissMenu(animated:))

Dismisses the currently active menu.

### Accessing the target document’s attributes

[`URL`](/documentation/UIKit/UIDocumentInteractionController/url)

The URL identifying the target file on the local filesystem.

[`UTI`](/documentation/UIKit/UIDocumentInteractionController/uti)

The type of the target file.

[`name`](/documentation/UIKit/UIDocumentInteractionController/name)

The name of the target file.

[`icons`](/documentation/UIKit/UIDocumentInteractionController/icons)

The images associated with the target file.

[`annotation`](/documentation/UIKit/UIDocumentInteractionController/annotation)

Custom property list information for the target file.

### Accessing the controller attributes

[`gestureRecognizers`](/documentation/UIKit/UIDocumentInteractionController/gestureRecognizers)

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

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

[`Sendable`](/documentation/Swift/Sendable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`UIActionSheetDelegate`](/documentation/UIKit/UIActionSheetDelegate)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)