Skip to content

Instantly share code, notes, and snippets.

@chrishannah
Created June 8, 2018 08:43
Show Gist options
  • Save chrishannah/6a9d25432f908f6c00d0c7e9afd7704d to your computer and use it in GitHub Desktop.
Save chrishannah/6a9d25432f908f6c00d0c7e9afd7704d to your computer and use it in GitHub Desktop.
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