I have a NSCollectionView populated using binding via NSArrayController.
All i am trying is to add an observer to either NSArrayController or NSCollectionView so that when ever the selection changes i got a call a function.
For example this is what i am doing for NSTextField change :
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.textDidChange(_:)), name: NSTextViewDidChangeSelectionNotification, object: nil)
I am looking for the correct way to do it.
Able to achieve with this simple code :
Added this to applicationDidFinishLaunching :
And this function gets called every time user/program selects an item in my NSArrayController