Как я могу связать имя меню «Canada» в моем меню расширяемой таблицы с новым View Controller с именем «Canada», а затем имя меню «Denmark» с View Controller с именем «Denmark» и так далее в моем Xcode -проект?
Вот мой код и несколько картинок.
![enter image description here](https://i.stack.imgur.com/2X7hq.png)
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, ExpandableHeaderViewDelegate {
@ IBOutlet слабая переменная tableView: UITableView!
var sections = [
Section(genre: "North America",
menytitel: ["USA", "Canada"],
expanded: false),
Section(genre: "Europe",
menytitel: ["Sweden", "Finland", "Denmark", "Ireland"],
expanded: false),
Section(genre: "Africa",
menytitel: ["Egypt", "Marocko"],
expanded: false),
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "labelCell")!
cell.textLabel?.text = sections[indexPath.section].menytitel[indexPath.row]
return cell