01-ViewController-6-0.swift 515 B

123456789101112
  1. extension ViewController: UITableViewDataSource {
  2. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  3. 1
  4. }
  5. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  6. let cell = tableView.dequeueReusableCell(withIdentifier: "SampleCell", for: indexPath) as! SampleCell
  7. cell.sampleLabel.text = "Index \(indexPath.row)"
  8. cell.sampleImageView.backgroundColor = .lightGray
  9. return cell
  10. }
  11. }