Slide 19
Slide 19 text
ViewController w/o Translator
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
private let tableView = UITableView(frame: UIScreen.main.bounds)
var todos: [Todo] = [] // Entity
override func viewDidLoad() {
...
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return todos.count + 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) ->
UITableViewCell {
let cell = UITableViewCell()
if indexPath.row < todos.count {
cell.textLabel?.text = todos[indexPath.row].title
} else {
cell.textLabel?.text = "+ Ճ͢Δ"
cell.textLabel?.textColor = .gray
}
return cell
}
}