Hello friends, the problem is this I am trying a taleView containing divisors and in those divisions different things and when one of them is touched, I would send it to another view, that is to say one second the problem is that when they are touched they always send to the same view is to say the same segue, try different ways but I always give the same thing in a single view the cells
import UIKit
class ViewControllerGeometry: UIViewController , UITableViewDelegate , UITableViewDataSource {
var tableArray : [Problems] = []
var tableArrayGeometryProblem : [Problemp] = []
var segueIdentifiers = ["prueba" , "B", "C"]
override func viewDidLoad() {
super.viewDidLoad()
let geometryproblem = Problems (name : "a")
tableArray.append(geometryproblem)
let perimeterProblem = Problemp(nameGeometryProblem: "c")
tableArrayGeometryProblem.append(perimeterProblem)
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func numberOfSections(in tableView: UITableView) -> Int {
return 4
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
switch section{
case 0:
return tableArray.count
case 1 :
return tableArrayGeometryProblem.count
default:
return 0
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cellGeometryproblem")! as UITableViewCell
let geometryproblem = tableArray [indexPath.row]
let perimeterProblemCalculation = tableArrayGeometryProblem [indexPath.row]
switch indexPath.section {
case 0:
cell.textLabel?.text = geometryproblem.name
case 1 :
cell.textLabel?.text = perimeterProblemCalculation.nameGeometryProblem
default:
return cell
}
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
performSegue(withIdentifier: segueIdentifiers[indexPath.row], sender: self)
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
var title = ""
switch section {
case 0:
title = "Area calculation "
case 1 :
title = "Pe
rimeter calculation "
case 2 :
title = "Sen theorem "
case 3 :
title = "Inside angles of the triangle "
default:
break
}
return title
}
}