From 382decd7da2f508fc6a188b6324592522529772f Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 16 Dec 2019 22:23:12 -0500 Subject: [PATCH] Fix search section titles --- Tusker/Screens/Search/SearchTableViewController.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Tusker/Screens/Search/SearchTableViewController.swift b/Tusker/Screens/Search/SearchTableViewController.swift index 1b90c6b5b6..4282005933 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 } } }