title: NSCoding with Nested Custom Objects?
body: <p>I have a series of nested objects that I am needing to put through the NSCoding protocol so that I can save the top level object into NSUserDefaults. </p>
  
  <p>Here is the structure of objects:</p>
  
  <p>'Instructor' class</p>
  
  <ul>
  <li>NSMutableArray that holds instances of...</li>
  </ul>
  
  <p>'Class' class</p>
  
  <ul>
  <li>NSMutableArray that holds instances of...</li>
  </ul>
  
  <p>'Student' class</p>
  
  <ul>
  <li>Name Property</li>
  <li>Number Property</li>
  <li>Money Property</li>
  </ul>
  
  <p>I am needing to save an instance of Instructor to NSUserDefaults or to documents for the app. As you can see the Instructor object is holding an array that is then holding instances of a class. That class object is holding instances of students. </p>
  
  <p>Is the NSCoding protocol recursive? What I mean by that is if I add the NSCoding protocol to each class, I could then save an Instructor object and it would recursively encode the contained objects? </p>
  
  <p>Would it then work the same way while decoding? I could just decode the one instructor class and it would recursively decode the objects contained because they also conform to the NSCoding protocol?</p>
  
  <p>How could I go about setting this up?</p>