Edit-
У меня есть 8 разных ViewControllers
и хотите, чтобы каждая ячейка выдвигала его, поэтому следует перейти к ViewControllers 1 и т. д.
Этот код хорошо подходит для делегирования мне другого контроллера представления с помощью segue, надеюсь, этот код поможет вам
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)
}