title: NSPasteBoard for Drag and Drop
body: <p>I try to move an <code>NSCollectionViewItem</code> within the same <code>NSCollectionView</code> to allow reordering of the items. The collection view item is a custom item representing multiple labels with strings from a custom object <code>Parameter</code>:</p>
  
  <pre><code>class Parameter: NSObject {
  
  var parameterName: String
  var parameterNominal: Double
  var parameterUpperTolerance: Double
  var parameterLowerTolerance: Double
  var parameterDistribution: String
  var parameterNotes: String
  var parameterDataArray: [Double]
  
  // MARK: - Initialization Methods
  ...
  }
  </code></pre>
  
  <p>Now, do I have to write the whole item/object into the 'NSPasteboard' to use drag and drop within the <code>NSCollectionView</code> correctly?
  Most of the drag 'n drop examples works with writing strings to pasteboard using <code>....register(forDraggedTypes: [NSPasteboardTypeString])</code>.</p>
  
  <p>I currently write one of the items string into the pasteboard and the drag 'n drop starts fine:</p>
  
  <pre><code>func collectionView(_ collectionView: NSCollectionView, pasteboardWriterForItemAt indexPath: IndexPath) -&gt; NSPasteboardWriting? {
      let pb = NSPasteboardItem()
      pb.setString(ParameterList.sharedInstance.parameters[indexPath.item].parameterName, forType: NSPasteboardTypeString)
      return pb
  }
  </code></pre>
  
  <p>... but it looks strange to write only part of the object to pasteboard when moving of the complete object is requested, right?</p>
  
  <p>How can I actually write my parameter object to the pasteboard (if needed)?</p>
  
  <p>What is happening behind the scene with the data in the pasteboard when using drag and drop?</p>
  
  <p>Thanks a lot!</p>