title: How to learn about KVC with swift 4.2
body: <p>I'm using Xcode 10.0 with swift 4.2 to learn about Key Value Coding from "Cocoa programming for OSX"</p>
  
  <p>I'm asked to create a simple class, which is a subclass of NSObject. The codes below:</p>
  
  <pre><code>import Cocoa
  
  class Student: NSObject {
      var name: String = ""
      var gradeLevel: Int = 0
  }
  
  let student1 = Student()
  
  
  student1.setValue("Benny", forKeyPath: "name")
  </code></pre>
  
  <p><strong>student1.setValue("Benny", forKeyPath: "name")</strong> </p>
  
  <p>Generates the following error message:</p>
  
  <blockquote>
    <p>Execution was interrupted, reason: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0).</p>
  </blockquote>
  
  <p>I've looked online and seem some issues regarding KVC such as :
  <a href="https://bugs.swift.org/browse/SR-5139" rel="noreferrer">https://bugs.swift.org/browse/SR-5139</a></p>
  
  <p>What am I doing wrong? The book was published in 2015.</p>