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

Opening URLs

The data for each course contains the URL of a web page that has a description of that class. The last functionality for this app is to open that web page in the user’s browser if the user double-clicks on the course.

To get the table view to respond to a double-click you must set the doubleAction and target of the table view. Unlike most target/action pairs, doubleAction must be set programmatically. Open MainWindowController.swift and add an outlet to the table view and the array controller:

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​ ​{​

 ​ ​ ​ ​@​I​B​O​u​t​l​e​t​ ​v​a​r​ ​t​a​b​l​e​V​i​e​w​:​ ​N​S​T​a​b​l​e​V​i​e​w​!​
 ​ ​ ​ ​@​I​B​O​u​t​l​e​t​ ​v​a​r​ ​a​r​r​a​y​C​o​n​t​r​o​l​l​e​r​:​ ...

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