swift 4 observe with @IBOutlet objects

I'd like to observe @IBOutlet NSPopUpButton property using swift 4.

But completion is never called.

I've tried with other NSPopUpButton keypaths \.indexOfSelectedItem, \.numberOfItems, but result is the same.

Local class properties observetion work.

Any ideas what i'm missing ?


class AppDelegate: NSObject, NSApplicationDelegate {
  @IBOutlet @objc dynamic weak var platformPopUpButton: NSPopUpButton!
  var observation: NSKeyValueObservation?
  func applicationDidFinishLaunching(_ aNotification: Notification) {
   observation = platformPopUpButton.observe(\NSPopUpButton.titleOfSelectedItem, options: [.new,.old]) { (popUpButton, changeType) in
   print("value changed \(popUpButton.titleOfSelectedItem)")
   }
  }
 }

}

My bad. Removed the reference.

Updated.

Sorry

swift 4 observe with @IBOutlet objects
 
 
Q