There needs to be a document describing the differences of NSExtensionItem, NSItemProvider and the items from an NSItemProvider

Originator:michaelhochs
Number:rdar://30184485 Date Originated:25-Jan-2017 12:18 PM
Status:Open Resolved:
Product:Documentation Product Version:10.2
Classification:UI/Usability Reproducible:Always
 
When dealing with share or action extensions, there is a documentation missing that explains the overall picture. It is very confusing. What Xcode generates, and what the documentation says, is that an `NSExtensionContext` can have multiple input items. It does not explain how these represent the users intent of sharing one or multiple things.

For example the Photos app only hands over a single `NSExtensionItem` with multiple `NSItemProvider`, one for each image that was shared. So it seems that the `NSItemProvider` represent the users intent of sharing items and each provider represents one thing the user actually wanted to share.

Safari on the other hand hands over two `NSExtensionItem` if the user wants to share a single image. Each of them having one `NSItemProvider`. One of them contains the image and one the URL. So it seems that `NSExtensionItem` are used to represent the same data in a different way. But if this is true, there also is an item provider’s `hasItemConformingToTypeIdentifier:` and the corresponding `loadItemForTypeIdentifier:` which can be used to transform data between different representations.

So at first it seems that NSExtensionItem and `loadItemForTypeIdentifier:` serve the same purpose. However I am sure there is another reason for this. The problem is, with the lack of documentation on this, it is very hard to understand how to pick which items to process.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!