Example code for the post "Hiding Extra Separators on a UITableView" on blog.chrishannah.me
import PlaygroundSupport | |
import UIKit | |
class DataSource: NSObject, UITableViewDataSource { | |
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return 5 | |
} | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) | |
cell.textLabel?.text = "Hello, world." | |
return cell | |
} | |
} | |
let tableView = UITableView(frame: CGRect(x: 0, y: 0, width:300, height: 400)) | |
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") | |
let dataSource = DataSource() | |
tableView.dataSource = dataSource | |
//tableView.tableFooterView = UIView() | |
PlaygroundPage.current.liveView = tableView | |
PlaygroundPage.current.needsIndefiniteExecution = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment