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

Using Notifications in Chatter

You are now ready to add notifications to Chatter. Here is the game plan you will follow for doing that: Each window controller will post a notification whenever the user sends a message. All of the window controllers will observe these notifications. When they observe one, they will update their text views to display the new message.

To begin, create two constant strings at the top of ChatWindowController.swift.

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

p​r​i​v​a​t​e​ ​l​e​t​ ​C​h​a​t​W​i​n​d​o​w​C​o​n​t​r​o​l​l​e​r​D​i​d​S​e​n​d​M​e​s​s​a​g​e​N​o​t​i​f​i​c​a​t​i​o​n​
 ​ ​ ​ ​=​ ​"​c​o​m​.​b​i​g​n​e​r​d​r​a​n​c​h​.​c​h​a​t​t​e​r​.​C​h​a​t​W​i​n​d​o​w​C​o​n​t​r​o​l​l​e​r​D​i​d​S​e​n​d​M​e​s​s​a​g​e​N​o​t​i​f​i​c​a​t​i​o​n​" ...

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