At this point, you should have a working
UITableView. So far, you’ve implemented both the view and the controller
parts of the MVC pattern. Now we’re going to return to Xcode and implement
the model. This needs to be separate from the view and the view
controller, since we want to decouple the way the data is stored from the
way it is displayed as much as possible. This will increase the
reusability of both the classes that handle the UI and the classes that
store the data behind the scenes, allowing us to change how parts of the
application work while affecting as little code as possible.
Right-click on the Classes folder in the Groups & Files pane and select Add→New File. When you see the New File window shown in Figure 5-9, make sure Cocoa Touch Class is selected on the left side of the screen. Next, select “Objective-C class,” make sure Subclass of NSObject is specified, and click on Next.
Figure 5-9. The New File window, which allows you to select the template Xcode will use to generate the new class interface and implementation file
You will then be asked for the filename of the new class. Type in City.m and click on Finish. Xcode will generate a pair of files, City.h and City.m, containing the template interface and the implementation of the new class, and will put them in the Classes folder. If you look at these files, you can see that since you specified that ...