title: Handle NSItemProvider data types in Share Extension (Swift)
body: <p>I have an issue with <strong>Share Extension</strong> programming in <strong>Swift</strong> (3). <br>
  My main problem is with the handling of the <code>data</code> type of a <em>NSItemProvider</em>.<br>
  Here's the issue: depending on the App that I launch my Extension from, I get a different type of data. For example:<br>
  I tell the application:<br></p>
  
  <pre><code>let IMAGE_TYPE = kUTTypeImage as String
  if attachment.hasItemConformingToTypeIdentifier(IMAGE_TYPE){
       attachment.loadItem(forTypeIdentifier: IMAGE_TYPE, options: nil){ data, error in
       ...
  }
  </code></pre>
  
  <p>(Note: <em>attachment</em> is of type <em>NSItemProvider</em>)<br><br>
  When executed from the Photos App, <code>data</code> is a URL so I create a UIImage from that and continue with that.<br>
  The problem is, that for some applications <code>data</code> already is a UIImage and I can't find how to do the case differentiation. <br>
  Best would probably be to check the data type of the <code>data</code> object but it's not trivial to me at least.
  <br>
  Thanks in advance for any help!</p>