One Quickie
UITableView data source (UITableView->Swift)
@IBOutlet var sessionsTableView : UITableView!
let cellReuseIdentifier = "Cell"
...
override func viewDidLoad() {
super.viewDidLoad()
self.sessionsTableView.register(UITableViewCell.self,
forCellReuseIdentifier: cellReuseIdentifier)
}
...
extension ViewController : UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier,
for: indexPath) as UITableViewCell
cell.textLabel?.text = "Spork (indexPath.row)"
return cell
}
}