O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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​, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required