---
title: "prepare(withActivityItems:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiactivity/prepare(withactivityitems:)"
---

# prepare(withActivityItems:)

Prepares your service to act on the specified data.

## Declaration

```swift
func prepare(withActivityItems activityItems: [Any])
```

## Parameters

- `activityItems`: An array of objects of varying types. These are the data objects on which to act.

## Discussion

Discussion The default implementation of this method does nothing. This method is called after the user has selected your service but before your service is asked to perform its action. Subclasses should override this method and use it to store a reference to the data items in the activityItems parameter. In addition, if the implementation of your service requires displaying additional UI to the user, you can use this method to prepare your view controller object and make it available from the activityViewController method.

## See Also

### Performing the activity

- [canPerform(withActivityItems:)](uikit/uiactivity/canperform(withactivityitems:).md)
- [activityViewController](uikit/uiactivity/activityviewcontroller.md)
- [perform()](uikit/uiactivity/perform().md)
- [activityDidFinish(_:)](uikit/uiactivity/activitydidfinish(_:).md)
