IBAction not being called.


I have an NSObject subclass :


// imports
import AppKit

class BKColorsMan : NSObject {
    //MARK: properties ----------------------------------------------------------------------------------------
    // stored :
    @IBOutlet weak var colorsArray: NSArrayController!
    // computed :
    //MARK: object lifetime management methods ----------------------------------------------------------------
    //MARK: class behavior methods ----------------------------------------------------------------------------
    override func awakeFromNib() {
    @IBAction func newColor(_ sender: Any) {
        let newColor = NSColor(calibratedRed: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
    //MARK: notification handling methods ---------------------------------------------------------------------
    //MARK: event handling methods ----------------------------------------------------------------------------
    //MARK: utility methods -----------------------------------------------------------------------------------


it has a single job. recieve an action message, and add an NSColor to an ArrayController.

the Action is set in IB, the outlet is set in IB. The class is instantiated and we know that from the awakeFromNib method.


the button (when set to trigger the “add” action in the array controller) works, and causes a problem: NSColor cannot be instantiated without arguments, it crashes the app, but we know there’s nothig wrong with the button.


When the button is targeting the newColor() method, it is never executed. Nothing happens. no debugPrint, no breakpoints… the action never goes anywhere. It doesn’t work. It doesn’t crash, and no errors are logged.


I don’t see what’s worng, do you?

Powered by WPeMatico


You may also like...

Comments are closed.