During conversion from swift3 to swift4 the convertor has changed NotificationCenter
to the following view:
NotificationCenter.default.addObserver(self, selector: #selector(myController.myFunction(_:)), name: NSNotification.Name.NSTextView.didChangeSelectionNotification, object: myNSTextView)
So, because of selector
in .addObserver()
myFunction now has @objc in front. Now the compiler is complaining, that the type NSNotification.Name
has no member NSTextView
. This is what convertor made, not me. I am confused.
How to fix this ?
Update. I have found the information here How to migrate NSWorkspace notifications to Swift 4?
So I have to use
NotificationCenter.default.addObserver(self, selector: #selector(myController.myFunction(_:)), name: NSTextView.didChangeSelectionNotification, object: myNSTextView)