Subclassing an Objective-C Class

In this section, you are going to create a new class named BNRItem. BNRItem will be a subclass of NSObject.

Figure 2.9  Class hierarchy including BNRItem

Class hierarchy including BNRItem

An instance of BNRItem will represent something that a person owns in the real world, like a laptop, a bicycle, or a backpack. In terms of Model-View-Controller, BNRItem is a model class. An instance of BNRItem stores information about a possession.

Once you have created the BNRItem class, you will populate the items array with instances of BNRItem instead of NSString.

Figure 2.10  A different class of items

Later in the book, ...

Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.