The NSTableViewDelegate Protocol
The second (and far simpler) part of this chapter is enabling the user to change the voice of the speech synthesizer by selecting a voice from the table. The user can make a selection by clicking the table row or by using the arrow keys to highlight a voice. User interaction with a table view is handled by the table view’s delegate. As the delegate of the table view, your object can react when the user interacts with the table view.
In MainWindowController.swift, add the NSTableViewDelegate protocol to the MainWindowController class definition.
import Cocoaclass MainWindowController: NSWindowController, NSSpeechSynthesizerDelegate,NSWindowDelegate, NSTableViewDataSource {class MainWindowController: ...
Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.