Clicking UI object NSComboBox
incorrectly executes comboBoxSelectionDidChange(...)
before it's .stringValue
changes instead of after as it's name implies. It does same as .comboBoxSelectionIsChanging
.
How can I have comboBoxSelectionDidChange(...)
execute after NSComboBox.stringValue
actually changes?
class ViewController: NSViewController, NSComboBoxDelegate {
@IBOutlet weak var comboBox: NSComboBox!
override func viewDidLoad() {
super.viewDidLoad()
self.usernameComboBox.delegate = self
}
func comboBoxSelectionDidChange(notification: NSNotification) {
print(usernameComboBox.stringValue)
// PRE-selected .stringValue = "ITEM 1"
// POST-selected .stringValue = "ITEM 2"
// selecting either item prints PRE-selected
}
}