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