title: encodeWithCoder: unrecognized selector sent to instance
body: <p>I'm attempting use NSCoding protocol to read and write data to plist. I get an exception when I try to write the [GolfHoles] which is a subclass of NSObject. I've read several posts with different approaches, but none have helped.</p>
  
  <pre><code>class GolfCourse: NSObject, NSCoding {
  var name: String = ""
  var location: String = ""
  var holes: [GolfHole] = [GolfHole]()
  
  init(holes: [GolfHole]) {
      self.holes = holes
  }
  
  // MARK: NSCoding Protocol
  func encodeWithCoder(aCoder: NSCoder) {
      aCoder.encodeObject(name, forKey: "name")
      aCoder.encodeObject(location, forKey: "location")
      aCoder.encodeObject(holes, forKey: "holes") // exception here
  
  }
  
  required init(coder aDecoder: NSCoder) {
      super.init()
      name = aDecoder.decodeObjectForKey("name") as! String
      location = aDecoder.decodeObjectForKey("location") as! String
      holes = aDecoder.decodeObjectForKey("holes") as! [GolfHole]
  
  }
  
  override init() {
      super.init()
      for var i=0; i&lt;18; i++ {
          let newHole = GolfHole()
          self.holes.append(newHole)
  
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>How do I write and read the array?</p>