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.

i​m​p​o​r​t​ ​C​o​c​o​a​

c​l​a​s​s​ ​M​a​i​n​W​i​n​d​o​w​C​o​n​t​r​o​l​l​e​r​:​ ​N​S​W​i​n​d​o​w​C​o​n​t​r​o​l​l​e​r​,​ ​N​S​S​p​e​e​c​h​S​y​n​t​h​e​s​i​z​e​r​D​e​l​e​g​a​t​e​, ...

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.