diff --git a/RxExample/RxExample/Examples/SimpleTableViewExampleSectioned/SimpleTableViewExampleSectionedViewController.swift b/RxExample/RxExample/Examples/SimpleTableViewExampleSectioned/SimpleTableViewExampleSectionedViewController.swift index 7cef9c9b..1f21edc5 100644 --- a/RxExample/RxExample/Examples/SimpleTableViewExampleSectioned/SimpleTableViewExampleSectionedViewController.swift +++ b/RxExample/RxExample/Examples/SimpleTableViewExampleSectioned/SimpleTableViewExampleSectionedViewController.swift @@ -47,6 +47,10 @@ class SimpleTableViewExampleSectionedViewController cell.textLabel?.text = "\(element) @ row \(indexPath.row)" return cell } + + dataSource.titleForHeaderInSection = { dataSource, sectionIndex in + return dataSource[sectionIndex].model + } items .bindTo(tableView.rx.items(dataSource: dataSource)) @@ -67,12 +71,6 @@ class SimpleTableViewExampleSectionedViewController .disposed(by: disposeBag) } - func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { - let label = UILabel(frame: CGRect.zero) - label.text = dataSource[section].model - return label - } - // to prevent swipe to delete behavior func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle { return .none