Есть таблица с названием товаров, изображениями и ссылкой на товар на сайте
На 1 экране сама таблица, на втором экране - описание товара c картинкой, а на третьем экране - WebView с открытием товара на сайте
Как сделать чтобы при открытии ячейки передавались данные в webView с нужной ссылкой на товар?
class Assortiment: UITableViewController {
let imageNameArray = ["Постельное белье",
"Покрывала)"]
let imageNameArray2 = ["https://maisondore.ru/postelnoe-belie/",
"https://maisondore.ru/pokryvala/"]
override func viewDidLoad() {
super.viewDidLoad()
}
// MARK: - Table view data source
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return imageNameArray.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Title", for: indexPath)
cell.imageView?.image = UIImage(named: imageNameArray[indexPath.row])
cell.textLabel?.text = imageNameArray[indexPath.row]
cell.textLabel?.numberOfLines = 0
return cell
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 60
}
// MARK: - Navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "Show Detail" {
if let indexPath = self.tableView.indexPathForSelectedRow {
let detailsVC = segue.destination as! DetailsVC
detailsVC.trackTitle = imageNameArray[indexPath.row]
}
}
}
}