Contents

canPerform(withActivityItems:)

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

Declaration

func canPerform(withActivityItems activityItems: [Any]) -> Bool

Parameters

  • activityItems:

    An array of objects of varying types. These are the data objects on which the service would act.

Return Value

true if your service can act on the specified data items or false if it cannot.

Discussion

The default implementation of this method returns false. Subclasses must override it and return true if the data in the activityItems parameter can be operated on by your service. Your implementation should check the types of the objects in the array and use that information to determine if your service can act on the corresponding data.

The UIActivityViewController object calls this method when determining which services to show to the user.

See Also

Performing the activity