<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIActivity/canPerform(withActivityItems:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIActivity(im)canPerformWithActivityItems:"
  },
  "title" : "canPerform(withActivityItems:)"
}
-->

# canPerform(withActivityItems:)

Queries whether the service can act on the specified data items.

```
func canPerform(withActivityItems activityItems: [Any]) -> Bool
```

## Parameters

`activityItems`

An array of objects of varying types. These are the data objects on which the service would act.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if your service can act on the specified data items or <doc://com.apple.documentation/documentation/Swift/false> if it cannot.

## Discussion

The default implementation of this method returns <doc://com.apple.documentation/documentation/Swift/false>. Subclasses must override it and return <doc://com.apple.documentation/documentation/Swift/true> if the data in the `activityItems` parameter can be operated on by your service. Your implementation should check the types of the objects in the array and use that information to determine if your service can act on the corresponding data.

The [`UIActivityViewController`](/documentation/UIKit/UIActivityViewController) object calls this method when determining which services to show to the user.

---

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)