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

Connecting the Course List Selection with the Web View

In order to load the course URL in the web view on selection you will need to trigger a call to loadURL(_:) when the table view selection changes.

Knowing what you know of Cocoa, how would you accomplish this? Come up with two or three approaches before reading on.

Got two or three? Here are some that we came up with:

  • Directly couple the two view controllers by adding a reference from CourseListViewController to WebViewController. Call a method on the WebViewController whenever the selected course changes.

    This would be the simplest approach and it would also be effective. But it has a serious disadvantage in the way that it couples the two view controllers directly ...

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