<!--
{
  "availability" : [
    "iOS: 3.2.0 - 6.0.0",
    "iPadOS: 3.2.0 - 6.0.0",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIDocumentInteractionControllerDelegate/documentInteractionController(_:performAction:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIDocumentInteractionControllerDelegate(im)documentInteractionController:performAction:"
  },
  "title" : "documentInteractionController(_:performAction:)"
}
-->

# documentInteractionController(_:performAction:)

Called when a document interaction controller wants its delegate to perform a specified action with the associated document.

```
optional func documentInteractionController(_ controller: UIDocumentInteractionController, performAction action: Selector?) -> Bool
```

## Parameters

`controller`

The document interaction controller managing an associated document.

`action`

The selector representing the action to perform. You can invoke this selector directly on the object responsible for performing the action or use it to call the appropriate method.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the action was performed successfully or <doc://com.apple.documentation/documentation/Swift/false> if it was not.

## Discussion

The supported `action` selectors for this method are `copy:` and `print:`. (The `print:` selector is available in iOS 4.2 and later. Printing is supported only on devices that support multitasking.)

To implement a `copy:` action, write the contents of the document—directly, or modified according to the intent of your app—to the pasteboard.

To implement a `print:` action, use the shared print interaction controller object. Assign the [`url`](/documentation/UIKit/UIDocumentInteractionController/url) property of the document interaction controller to the print interaction controller’s [`printingItem`](/documentation/UIKit/UIPrintInteractionController/printingItem) property. Then present the printing user interface. For details, refer to [`UIPrintInteractionController`](/documentation/UIKit/UIPrintInteractionController) and to [Printing](https://developer.apple.com/library/archive/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/Printing/Printing.html#//apple_ref/doc/uid/TP40010156-CH12) in [Drawing and Printing Guide for iOS](https://developer.apple.com/library/archive/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40010156).

Instead of implementing printing code in this method, you can rely on the built-in printing support of the Quick Look framework. For document types that can be previewed, the options menu of a document interaction controller always contains a Quick Look item. If the user chooses that item, the resulting Quick Look view includes an action button in the navigation bar that, when tapped, offers a Print button. In this case, the system automatically handles printing. For details, refer to <doc://com.apple.documentation/documentation/QuickLook/QLPreviewController> and to [Using the Quick Look Framework](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/UsingtheQuickLookFramework.html#//apple_ref/doc/uid/TP40010413) in [Document Interaction Programming Topics for iOS](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40010403).

---

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)