Bug on page 155

There is an example on page 155 that shows the Person class. I think this class should inherit from NSObject. Otherwise it cannot participate in KVO.

In the same example, I get an error that the computed property 'fullName" must have an explicit type, i.e. dynamic var fullName: String {…}

Thank you for reporting these! As you both are pointing out, the code listing should be

class Person: NSObject {
    dynamic var firstName = ""
    dynamic var lastName = ""
    dynamic var fullName: String {
        return "\(firstName) \(lastName)"
    class func keyPathsForValuesAffectingFullName() -> NSSet {
        return Set(["firstName", "lastName"])

We’ll get this added to the errata.