title: Storing and retrieving a custom object from NSPasteBoard
body: <p>I have an object that belongs to this class that contains the following declarations:</p>
  
  <p><strong>HEADER</strong></p>
  
  <pre><code>@interface MyClassObject : NSObject &lt;NSCopying, NSPasteboardWriting, NSPasteboardReading&gt;
  
  @property (nonatomic, strong) NSArray *children;
  @property (nonatomic, assign) NSInteger type;
  @property (nonatomic, strong) NSString *name;
  @property (nonatomic, strong) id node;
  </code></pre>
  
  <p><code>children</code> holds other objects of this class, <code>node</code> holds objects that can be <code>NSView</code> or <code>NSImageView</code>.</p>
  
  <p>I would like to be able to copy and paste objects of this type to/from <code>NSPasteboard</code>.</p>
  
  <p>I have google around but the explanations are vague.</p>
  
  <p>What should I do to make this class copiable/readable to NSPasteboard or in other words, make it conform to <code>NSPasteboardWriting</code> and <code>NSPasteboardReading</code> protocols?</p>
  
  <p>I don't have the slightest clue on how this is done and as usual, Apple documetation and nothing is the same thing.</p>