I have the following code in a simple macOS test app using Xcode 12 and IB. It has one split view window and the only code is the code below. I built it to learn how to allow a user to change background colors for a window. This code works fine in a single Window/View Controller. However, when I try the same code in a split Window/View Controller the action code (changeColor) does not get called. Does any body know way this is the case as well as how to get this code working with a split screen controller.
}
Code Block class ViewController: NSViewController { let colorPanel = NSColorWell() override func viewDidLoad() { super.viewDidLoad() self.view.wantsLayer = true self.view.layer?.backgroundColor = NSColor.gray.cgColor // Do any additional setup after loading the view. } @IBAction func changeBKColor(_ sender: NSButton) { colorPanel.activate(true) colorPanel.action = #selector(changeColor) } @objc func changeColor(_ sender: NSButton?) { print("Layer is", self.view.layer!) self.view.layer?.backgroundColor = colorPanel.color.cgColor
}