Table View Controller

To get our app to do something interesting, we will now need to write some code. We begin with our ItemTableViewController. Opening the file, you will see there is some template code already and some code that has been commented. We will fill out these code blocks one by one to understand what each of these methods does. In our controller, we need to do the following:

  1. Define a controller instance property called item, which will be an array of Item objects. This is the same Item class we created earlier in this chapter. We will set items to default to the fake items that we will get from the fake method defined on Item class that you created in the earlier exercise:
class ItemTableViewController: UITableViewController ...

Get Hands-On Full-Stack Development with Swift now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.