class TableViewController: UIViewController, UITableViewDelegate, UITableViewDataSource{
var menu: Array = [String]()
override func viewDidLoad() {
super.viewDidLoad()
menu = ["home", "Logout"]
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return menu.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell: TableViewCell = tableView.dequeueReusableCell(withIdentifier: "TableViewCell") as! TableViewCell
cell.labelmanu.text = menu[indexPath.row]
return cell
}
Use the array to declare your data in tableview and delegates and datasource method to update and set the data accordingly