// class TestTableViewController: UITableViewController { var myData: [Int] = [] override func viewDidLoad() { super.viewDidLoad() // fill myData with 1000, 1100, 1200, 1300, 1400 myData = (0..<5).map { 1000 + ($0 * 100) } tableView.register(UITableViewCell.self, forCellReuseIdentifier: "c") } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return myData.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { // output the row and the data for that row print("r:\t", indexPath.row, "\t", myData[indexPath.row], "\tin cellForRowAt") let c = tableView.dequeueReusableCell(withIdentifier: "c", for: indexPath) c.textLabel?.text = "\(myData[indexPath.row])" return c } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { self.myReload() } func myReload() { print() print("on entry to myReload(), myData is") print() // output the updated data print(myData) print() print("now call .reloadData()") // call .reloadData here tableView.reloadData() print() print("now modify data") print() for i in 0..