Slide 16
Slide 16 text
DVTSourceTextView
func listenNotification() {
NSNotificationCenter.defaultCenter().addObserver(
self, selector: #selector(handleSelectionChange(_:)),
name: NSTextViewDidChangeSelectionNotification, object: nil)
}
func handleSelectionChange(note: NSNotification) {
guard let DVTSourceTextView = NSClassFromString("DVTSourceTextView") as? NSObject.Type,
object = note.object where object.isKindOfClass(DVTSourceTextView.self),
let textView = object as? NSTextView
else { return }
self.textView = textView
}