Code from our book, Learning Cocoa with Objective-C Third Edition.