<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIActivityViewController/CompletionWithItemsHandler-swift.typealias",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:@T@UIActivityViewControllerCompletionWithItemsHandler"
  },
  "title" : "UIActivityViewController.CompletionWithItemsHandler"
}
-->

# UIActivityViewController.CompletionWithItemsHandler

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

```
typealias CompletionWithItemsHandler = (UIActivity.ActivityType?, Bool, [Any]?, (any Error)?) -> Void
```

## Discussion

Upon the completion of an activity, or the dismissal of the activity view controller, the view controller’s completion block is executed. You can use this block to execute any final code related to the service. The parameters of this block are as follows:

- activityType: The type of the service that was selected by the user. For custom services, this is the value returned by the [`activityType`](/documentation/UIKit/UIActivity/activityType-swift.property) method of a [`UIActivity`](/documentation/UIKit/UIActivity) object. For system-defined activities, it is one of the strings listed in “Built-in Activity Types” in [`UIActivity`](/documentation/UIKit/UIActivity).
- completed: <doc://com.apple.documentation/documentation/Swift/true> if the service was performed or <doc://com.apple.documentation/documentation/Swift/false> if it was not. This parameter is also set to <doc://com.apple.documentation/documentation/Swift/false> when the user dismisses the view controller without selecting a service.
- returnedItems: An array of <doc://com.apple.documentation/documentation/Foundation/NSExtensionItem> objects containing any modified data. Use the items in this array to get any changes made to the original data by an extension. If no items were modified, the value of this parameter is `nil`.
- activityError: An error object if the activity failed to complete, or `nil` if the the activity completed normally.

---

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)