The new signature validation is not called

This method is not called.

func validateRaise(raiseNumberPointer:
AutoreleasingUnsafeMutablePointer<NSNumber?>) throws {
let raiseNumber = raiseNumberPointer.memory
if raiseNumber == nil {
let domain = "UserInputValidationErrorDomain"
let code = 0
let userInfo = [NSLocalizedDescriptionKey : “An employee’s raise must be a number.”]
throw NSError(domain: domain, code: code, userInfo: userInfo)
}
}

I forgot to validate immediately the raise textfield.
Everything’s fine now. The method is called.

This function is never called in my implementation regardless of the fact that I have Validates Immediately checked for the Table View Cell. I’ve checked the documentation, the function is specified as indicated in the code. Can’t figure this one out.

I’m having the same issue. I modified the function as follows at the suggestion of another thread on this topic to make the code compliant with Swift 3.0:

import Foundation

class Employee: NSObject {
var name: String? = “New Employee”
var raise: Float = 0.05

override func validateValue(_ ioValue: AutoreleasingUnsafeMutablePointer<AnyObject?>, forKey inKey: String) throws {
    let raiseNumber = ioValue.pointee // "memory" is now "pointee" in Swift 3
    if inKey == "raise" && raiseNumber == nil {
        let domain = "UserInputValidationErrorDomain"
        let code = 0
        let userInfo = [NSLocalizedDescriptionKey : "An employee's raise must be a number."]
        throw NSError(domain: domain, code: code, userInfo: userInfo)
    }
}

}

The method is never being called.

I found my answer after browsing the forum for Chapter 9. In Document.xib, I had to change the class name for NSArrayController to Employee.RaiseMan. That initially caused the application to crash when clicking the new employee button, but I solved that by making the attributes of Employee @objc dynamic var to be compliant with later versions of Swift:

class Employee: NSObject {
@objc dynamic var name: String? = “New Employee”
@objc dynamic var raise: Float = 0.05