Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of `returningItems` in `NSExtensionContext.completeRequest`?

Tags:

ios

swift

I'm working on a standard Action Extension in my iOS app and the Xcode template contains the lines:

@IBAction func done() {
    // Return any edited content to the host app.
    // This template doesn't do anything, so we just echo the passed in items.
    self.extensionContext!.completeRequest(returningItems: self.extensionContext!.inputItems, completionHandler: nil)
}

Here is the documentation for completeRequest.

Questions

  • What is the purpose of passing returningItems to completeRequest?
  • Do apps actually receive edited content from an action extension?
  • If yes, where can I find the API on the receiving end?
  • What are the consequences for me to pass an empty array?
like image 929
tombardey Avatar asked Dec 06 '17 11:12

tombardey


1 Answers

I made small research for other question, that may be found helpful here.

Shortly:

There is callback in UIActivityViewController with parameter:

returnedItems - An array of NSExtensionItem objects containing any modified data. Use the items in this array to get any changes made to the original data by an extension

like image 170
Artem Avatar answered Sep 28 '22 11:09

Artem