diff --git a/Tusker/Screens/Search/SearchTableViewController.swift b/Tusker/Screens/Search/SearchTableViewController.swift index 1b90c6b5..42820059 100644 --- a/Tusker/Screens/Search/SearchTableViewController.swift +++ b/Tusker/Screens/Search/SearchTableViewController.swift @@ -156,8 +156,12 @@ extension SearchTableViewController { } class DataSource: UITableViewDiffableDataSource { - override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { - return Section.allCases[section].displayName + override func tableView(_ tableView: UITableView, titleForHeaderInSection sectionIndex: Int) -> String? { + let currentSnapshot = snapshot() + for section in Section.allCases where currentSnapshot.indexOfSection(section) == sectionIndex { + return section.displayName + } + return nil } } }