How do I set returnedItems in the CompletionWithItemsHandler for UIActivityViewController

I have a UIActivityViewController. I want to be able to pass back values from the UIActivity to the CompletionWithItemsHandler using returnedItems. In the UIActivity, I'm using a UIViewController to prompt the user for parameters. How to I set values so they are returned in returnedItems?

Thanks!

Could you show your code ? And explain what is precisely the problem ?

API is:

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

So you call as:

       activityVC.completionWithItemsHandler = { (activity, success, modifiedItems, error) in
            print("activity: \(activity), success: \(success), items: \(modifiedItems), error: \(error)")
      }

If you want to reuse returned items, just have a var for it:

        var returnedItems: [Any]? = nil
        activityVC.completionWithItemsHandler = { (activity, success, modifiedItems, error) in
            returnedItems = modifiedItems
        }

Hope that answers your question.

How do I set returnedItems in the CompletionWithItemsHandler for UIActivityViewController
 
 
Q