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

# UIActivity

An abstract class that you subclass to implement app-specific services.

```
class UIActivity
```

## Overview

You should subclass [`UIActivity`](/documentation/UIKit/UIActivity) only if you want to provide custom services to people. A service takes data that’s passed to it, does something to that data, and returns the results. For example, a social media service might take whatever text, images, or other content is provided to it and post them to a person’s account. Activity objects are used in conjunction with a [`UIActivityViewController`](/documentation/UIKit/UIActivityViewController) object, which is responsible for presenting services to people.

The system already provides support for many standard services and makes them available through the [`UIActivityViewController`](/documentation/UIKit/UIActivityViewController) object. For example, the standard activity view controller supports emailing data, posting items to one of a person’s social media accounts, and several other options. You don’t have to provide custom services for any of the built-in types.

### Subclassing notes

This class must be subclassed before it can be used. The job of an activity object is to act on the data provided to it and to provide some meta information that iOS can display to people. For more complex services, an activity object can also display a custom user interface and use it to gather additional information from people.

#### Methods to override

When subclassing, you must always override the following methods and use them to provide information about your service:

- [`activityType`](/documentation/UIKit/UIActivity/activityType-swift.property)
- [`activityTitle`](/documentation/UIKit/UIActivity/activityTitle)
- [`activityImage`](/documentation/UIKit/UIActivity/activityImage)
- [`canPerform(withActivityItems:)`](/documentation/UIKit/UIActivity/canPerform(withActivityItems:))
- [`prepare(withActivityItems:)`](/documentation/UIKit/UIActivity/prepare(withActivityItems:))
- [`activityCategory`](/documentation/UIKit/UIActivity/activityCategory)

If your [`canPerform(withActivityItems:)`](/documentation/UIKit/UIActivity/canPerform(withActivityItems:)) method indicates that your subclass is able to operate on the specified data, the active [`UIActivityViewController`](/documentation/UIKit/UIActivityViewController) object displays your service to people. When a person selects your service, the activity view controller calls the [`prepare(withActivityItems:)`](/documentation/UIKit/UIActivity/prepare(withActivityItems:)) method followed by only one of these methods:

- [`activityViewController`](/documentation/UIKit/UIActivity/activityViewController) — Returns a view controller to present to a person. If your service requires additional input from a person, override this method and use it to return the view controller object responsible for presenting your custom UI. (You don’t need to present the view controller yourself.) After your view controller object gathers the needed input, it’s responsible for initiating the task associated with the service.
- [`perform()`](/documentation/UIKit/UIActivity/perform()) — Performs the service without displaying any additional UI. If your service doesn’t need additional input from a person, override this method and perform the task associated with the service.

## Topics

### Getting the activity information

[`activityCategory`](/documentation/UIKit/UIActivity/activityCategory)

The category of the activity, which may be used to group activities in the UI.

[`UIActivity.Category`](/documentation/UIKit/UIActivity/Category)

An enumeration that defines categories of activities.

[`activityType`](/documentation/UIKit/UIActivity/activityType-swift.property)

The type of service being provided.

[`UIActivity.ActivityType`](/documentation/UIKit/UIActivity/ActivityType-swift.struct)

A structure that describes the types of activities for which the system has built-in support.

[`activityTitle`](/documentation/UIKit/UIActivity/activityTitle)

A user-readable string that describes the service.

[`activityImage`](/documentation/UIKit/UIActivity/activityImage)

An image that identifies the service to the user.

### Performing the activity

[`canPerform(withActivityItems:)`](/documentation/UIKit/UIActivity/canPerform(withActivityItems:))

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

[`prepare(withActivityItems:)`](/documentation/UIKit/UIActivity/prepare(withActivityItems:))

Prepares your service to act on the specified data.

[`activityViewController`](/documentation/UIKit/UIActivity/activityViewController)

The view controller to present to the user.

[`perform()`](/documentation/UIKit/UIActivity/perform())

Performs the service when no custom view controller is provided.

[`activityDidFinish(_:)`](/documentation/UIKit/UIActivity/activityDidFinish(_:))

Notifies the system that your activity object has completed its work.



---

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)