<!--
{
  "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/perform()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIActivity(im)performActivity"
  },
  "title" : "perform()"
}
-->

# perform()

Performs the service when no custom view controller is provided.

```
func perform()
```

## Discussion

The default implementation of this method does nothing. If your service doesn’t provide any custom UI using the [`activityViewController`](/documentation/UIKit/UIActivity/activityViewController) method, override this method and use it to perform the activity. Your activity must operate on the data items received in the [`prepare(withActivityItems:)`](/documentation/UIKit/UIActivity/prepare(withActivityItems:)) method.

This method is called on your app’s main thread. If your app can complete the activity quickly on the main thread, do so and call the [`activityDidFinish(_:)`](/documentation/UIKit/UIActivity/activityDidFinish(_:)) method when it’s done. If performing the activity might take some time, use this method to start the work in the background and then exit without calling [`activityDidFinish(_:)`](/documentation/UIKit/UIActivity/activityDidFinish(_:)) from this method. When your background work has completed, call [`activityDidFinish(_:)`](/documentation/UIKit/UIActivity/activityDidFinish(_:)). You must call [`activityDidFinish(_:)`](/documentation/UIKit/UIActivity/activityDidFinish(_:)) on the main thread.

---

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)