<!--
{
  "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(_:canPerformAction:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIDocumentInteractionControllerDelegate(im)documentInteractionController:canPerformAction:"
  },
  "title" : "documentInteractionController(_:canPerformAction:)"
}
-->

# documentInteractionController(_:canPerformAction:)

Called when a document interaction controller needs to know whether the specified action can be performed on the associated document.

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

## Parameters

`controller`

The document interaction controller managing an associated document.

`action`

The selector representing the action in question.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the specified action is supported for the associated document or <doc://com.apple.documentation/documentation/Swift/false> if it is not. If you do not implement this method, the return value is assumed to be <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

When building the options menu (invoked, for example, by the user performing a long press gesture), a document interaction controller calls this method to find out if your app can perform various actions. If you implement this method for a given action, you must also implement the [`documentInteractionController(_:performAction:)`](/documentation/UIKit/UIDocumentInteractionControllerDelegate/documentInteractionController(_:performAction:)) method for that action.

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.)

For each action that you implement in the [`documentInteractionController(_:performAction:)`](/documentation/UIKit/UIDocumentInteractionControllerDelegate/documentInteractionController(_:performAction:)) delegate method, return <doc://com.apple.documentation/documentation/Swift/true> from this method if that action is available for the document.

---

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)