---
title: UIDocumentInteractionController
framework: uikit
role: symbol
role_heading: Class
path: uikit/uidocumentinteractioncontroller
---

# UIDocumentInteractionController

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

## Declaration

```swift
@MainActor class UIDocumentInteractionController
```

## Overview

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.

## Topics

### Creating the document interaction controller

- [init(url:)](uikit/uidocumentinteractioncontroller/init(url:)-8wb4p.md)

### Handling document-related interactions

- [delegate](uikit/uidocumentinteractioncontroller/delegate.md)
- [UIDocumentInteractionControllerDelegate](uikit/uidocumentinteractioncontrollerdelegate.md)

### Presenting and dismissing a document preview

- [presentPreview(animated:)](uikit/uidocumentinteractioncontroller/presentpreview(animated:).md)
- [dismissPreview(animated:)](uikit/uidocumentinteractioncontroller/dismisspreview(animated:).md)

### Presenting and dismissing menus

- [presentOptionsMenu(from:in:animated:)](uikit/uidocumentinteractioncontroller/presentoptionsmenu(from:in:animated:).md)
- [presentOptionsMenu(from:animated:)](uikit/uidocumentinteractioncontroller/presentoptionsmenu(from:animated:).md)
- [presentOpenInMenu(from:in:animated:)](uikit/uidocumentinteractioncontroller/presentopeninmenu(from:in:animated:).md)
- [presentOpenInMenu(from:animated:)](uikit/uidocumentinteractioncontroller/presentopeninmenu(from:animated:).md)
- [dismissMenu(animated:)](uikit/uidocumentinteractioncontroller/dismissmenu(animated:).md)

### Accessing the target document’s attributes

- [url](uikit/uidocumentinteractioncontroller/url.md)
- [uti](uikit/uidocumentinteractioncontroller/uti.md)
- [name](uikit/uidocumentinteractioncontroller/name.md)
- [icons](uikit/uidocumentinteractioncontroller/icons.md)
- [annotation](uikit/uidocumentinteractioncontroller/annotation.md)

### Accessing the controller attributes

- [gestureRecognizers](uikit/uidocumentinteractioncontroller/gesturerecognizers.md)

### Initializers

- [init(URL:)](uikit/uidocumentinteractioncontroller/init(url:)-39lrq.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [UIActionSheetDelegate](uikit/uiactionsheetdelegate.md)

## See Also

### Documents and directories

- [Customizing a document-based app’s launch experience](uikit/customizing-a-document-based-app-s-launch-experience.md)
- [Adding a document browser to your app](uikit/adding-a-document-browser-to-your-app.md)
- [Providing access to directories](uikit/providing-access-to-directories.md)
- [Building an app with a document browser](uikit/building-an-app-with-a-document-browser.md)
- [Building a document browser app for custom file formats](uikit/building-a-document-browser-app-for-custom-file-formats.md)
- [UIDocumentViewController](uikit/uidocumentviewcontroller.md)
- [UIDocumentBrowserViewController](uikit/uidocumentbrowserviewcontroller.md)
- [UIDocumentPickerViewController](uikit/uidocumentpickerviewcontroller.md)
