O'Reilly logo

Swift Programming: The Big Nerd Ranch Guide by John Gallagher, Matthew Mathias

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

Silver Challenge

Right now, users of VocalTextEdit can click the Speak or Stop buttons at any time. That is not ideal: Clicking Speak while VocalTextEdit is currently synthesizing will abruptly restart the vocalization, for example. Modify VocalTextEdit so that users can only click on Speak if the application is not currently synthesizing and only click Stop when it is.

To complete this challenge, you will need a way to set the enabled property of the two buttons. You will also need a way to know when speaking ends. (You already know when it starts.) Investigate the documentation for the NSSpeechSynthesizerDelegate protocol to find out how to do these things.

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