Created
June 8, 2018 08:43
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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