I have an NSTextField bound to a key in the user defaults. When I press enter or leave the field the bound value is properly updated (I have an observer for it). However when I programmatically set the value of the text field the bound value is not updated. The text field however shows the new string I set with:
stockField1.stringValue = [sender representedObject];
(it's set from a menu item handler). Is it necessary to send an additional message to the text field or how else can I make this work?
Manually triggering key-value binding goes like this:
Here's the Swift version of Mike's answer, for reference: