In my point of view, this is much better and easy to understand according to the code below:
import Foundation import UIKit class testTableViewController: UITableViewController { override func viewDidLoad{ super.viewDidLoad() } let nameList = ["name1","name2","name3","name4","name5","name6"] override func tableView(tableView: UITableView, numberOfRowsInSection section: Int)-> Int{ return nameList.count } override func tableView(TableView:UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{ let cell = tableView.dequeueReusableCellWithIdentifier("test_row", forIndexPath: indexPath) let row1 = nameList[indexPath.row] cell.textLabel? .text = row1 return cell } }
source share