Skip to content

Instantly share code, notes, and snippets.

@okket okket/TableView.swift
Last active Aug 29, 2015

Embed
What would you like to do?
import UIKit
class PlainTableViewController: UITableViewController {
var dataSource = String[]()
override func viewDidLoad() {
super.viewDidLoad()
dataSource = ["one","two","three"]
tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "Cell")
}
override func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
return dataSource.count
}
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell? {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell
cell.textLabel.text = dataSource[indexPath.row]
return cell
}
}
let test = PlainTableViewController()
test.view
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.