Class

UIActivityViewController

A view controller that you can use to offer various services from your app.

Overview

The system provides several standard services, such as copying items to the pasteboard, posting content to social media sites, sending items via email or SMS, and more. Apps can also define custom services.

Your app is responsible for configuring, presenting, and dismissing this view controller. Configuration for the view controller involves specifying the data objects on which the view controller should act. (You can also specify the list of custom services your app supports.) When presenting the view controller, you must do so using the appropriate means for the current device. On iPad, you must present the view controller in a popover. On iPhone and iPod touch, you must present it modally.

Topics

Initializing the Activity View Controller

init(activityItems: [Any], applicationActivities: [UIActivity]?)

Initializes and returns a new activity view controller object that acts on the specified data.

Accessing the Completion Handler

var completionWithItemsHandler: UIActivityViewControllerCompletionWithItemsHandler?

The completion handler to execute after the activity view controller is dismissed.

var completionHandler: UIActivityViewControllerCompletionHandler?

The completion handler to execute after the activity view controller is dismissed.

Deprecated

Excluding Specific Activity Types

var excludedActivityTypes: [UIActivityType]?

The list of services that should not be displayed.

Constants

typealias UIActivityViewControllerCompletionWithItemsHandler

A completion handler to execute after the activity view controller is dismissed.

typealias UIActivityViewControllerCompletionHandler

A completion handler to execute after the activity view controller is dismissed.

See Also

Shared Activities

class UIActivity

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

protocol UIActivityItemSource

A set of methods used by an activity view controller to retrieve the data items to act on.

class UIActivityItemProvider

A proxy for data passed to an activity view controller.