// // ViewController.swift // TableViewOnly // // Created by dev1 on 5/20/22. // import UIKit var restaurants: [String] = [ "barrafina", "bourkestreetbakery", "cafedeadend", "cafeloisl", "cask", "confessional", "donostia", "fiveleaves", "forkee", "graham", "haigh", "homei", "palomino", "petiteoyster", "posatelier", "restaurant", "royaloak", "teakha", "traif", "upstate", "waffleandwolf" ] class ViewController: UIViewController { @IBOutlet weak var tableView: UITableView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } } extension ViewController : UITableViewDataSource { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "democell", for: indexPath) as! DemoTableViewCell let restaurant: String = restaurants[indexPath.row] cell.demoImageView.image = UIImage(named: restaurant) return cell } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return restaurants.count } func numberOfSections(in tableView: UITableView) -> Int { return 1 } } //extension ViewController : UITableViewDelegate { // // func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { // // let alert = UIAlertController(title: "Hello", message: "Row Number \(indexPath.row + 1)", preferredStyle: .alert) // // alert.addAction(UIAlertAction(title: "Ok", style: .destructive, handler: nil)) // // self.present(alert, animated: true, completion: nil) // // } // //}