Initializes and returns a new activity view controller object that acts on the specified data.
SDKs
- iOS 6.0+
- Mac Catalyst 13.0+
Framework
- UIKit
Declaration
init(activityItems: [Any], applicationActivities: [UIActivity]?)
Parameters
activityItems
The array of data objects on which to perform the activity. The type of objects in the array is variable and dependent on the data your application manages. For example, the data might consist of one or more string or image objects representing the currently selected content.
Instead of actual data objects, the objects in this array can be objects that adopt the
UIActivity
protocol, such asItem Source UIActivity
objects. Source and provider objects act as proxies for the corresponding data in situations where you do not want to provide that data until it is needed. Note that you should not reuse an activity view controller object that includes aItem Provider UIActivity
object in itsItem Provider activity
array.Items This array must not be
nil
and must contain at least one object.applicationActivities
An array of
UIActivity
objects representing the custom services that your application supports. This parameter may benil
.
Return Value
The activity view controller to present.
Discussion
It is your responsibility to present and dismiss the view controller using the appropriate means for the given device idiom. On iPad, you must present the view controller in a popover. On other devices, you must present it modally.