When I run the following code, I get an empty table view. I have a TableViewController set up in my storyboard with content set to dynamic prototypes and with a prototype cell that has style set to basic in the attributes inspector. my TableViewCell has the identifier cell. Can anyone help me put the strings in the wines list in prototype cells?
code:
import UIKit
class ListTableViewController: UITableViewController {
let wines = [ "Barbera", "Zinfandel", "Viognier" ]
override func viewDidLoad() {
super.viewDidLoad()
}
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return wines.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.textLabel?.text = wines[indexPath.row]
return cell
}
}