Я запрашиваю данные из VC и отправляю вывод в другой VC, у которого есть TableViewCell.с результатами в ячейке, я пытаюсь выполнить другой запрос к Firebase и отобразить результаты в другом VC, который имеет пользовательскую ячейку прототипа.Я могу вручную выполнить запросы в обоих случаях, моя проблема (путаница) заключается в том, как вызвать кнопку IBAction для запуска запроса.Я не знаю, как привести ячейку для выполнения запроса и выполнить переход к третьему VC
mainVC
@IBAction func getDataPressed(_ sender: Any) {
query......
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "cell1" {
let vc = segue.destination as! secondVC
vc.data = data
self.performSegue(withIdentifier: "cell1", sender: self)
}
}
secondVC
func tableView(_ tableView: UITableView, numberOfRowsInSection section:
Int) -> Int {
return info.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath:
IndexPath) -> UITableViewCell {
if let cell = tableView.dequeueReusableCell(withIdentifier:
"secondVcCell", for: indexPath)
as? secondVcCell {
cell.configureCell(inf: info[indexPath.row])
return cell
}
return UITableViewCell()
secondVcCell
var delegate: secondVC?
@IBAction func getDataPressed2(_ sender: Any) {
query ........
}
self.delegate?.performSegue(withIdentifier: "cell2", sender: self)
3rdVC
func tableView(_ tableView: UITableView, numberOfRowsInSection section:
Int) -> Int {
return info2.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath:
IndexPath) -> UITableViewCell {
if let cell = tableView.dequeueReusableCell(withIdentifier: "thirdVcCell",
for: indexPath)
as? dataCell2 {
cell.configureCell(inf1: info2[indexPath.row])
return cell
}
return UITableViewCell()