Edit-
I have 8 different ViewControllers and want each of the cell push it so should go to the ViewControllers 1, etc.
This code works good for me to delegate to another view controller with segue, hope this code will help you
Edit-
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if isPurchased() {
return freeQuotes.count
}
return freeQuotes.count + 1
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
if indexPath.row < freeQuotes.count {
cell.textLabel?.text = freeQuotes[indexPath.row]
cell.textLabel?.font = UIFont(name: (cell.textLabel?.font.fontName)!, size:20)
cell.textLabel?.textColor = cell.textLabel?.textColor = colorLiteral
cell.accessoryType = .disclosureIndicator
} else {
cell.textLabel?.text = ""
cell.textLabel?.font = UIFont(name: (cell.textLabel?.font.fontName)!, size:20)
cell.textLabel?.textColor = colorLiteral
cell.accessoryType = .disclosureIndicator
}
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == freeQuotes.count {
}
performSegue(withIdentifier: segueIndenidentity[indexPath.row], sender: self)
}