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 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.