Member-only story
Two UITableViews One UIViewController
That must be chocolate ice-creme
Difficulty: Beginner | Easy | Normal | Challenging
Prerequisites:
- You must be able to create a Single View Application, although you can complete the same in Playgrounds. You’ll need to know about IF statements. Knowledge of how to create a UITableView instance would be useful, but I’ll take you through the basics in this tutorial
Terminology
UITableView: A view that presents data using rows arranged in a single column
View controller: Sits between the view and the model, tying them together (usually using the delegate pattern). The controller is not tightly bound to a concrete view, and communicates via a protocol to an abstraction. An example of this is the way that a UITableView communicates with its data source through the UITableViewDataSource protocol. Think of it as the how of the App. The primary job of the controller is to format the data from the model for the view to display.
The challenge
What would happen if I were to whack two UITableView
instances into a single view controller?
How might both instances communicate with the dataSource and the delegate?