-
-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
Hello!
I have a suggestion to improve about indexTitles for sections.
Below is the current code for section indexes. It is based on the indexTitle property of the TableSection. However pretty common case is to have the full alphabet in the indexes even if your table contains only couple sections with titles like C and H. So I think the best way would be to somehow divide indexTitles from sections.
I will be able to make a PR about that as soon as we switch our project from FlowKit to Owl.
// MARK: - Section Indexes -
public func sectionIndexTitles(for tableView: UITableView) -> [String]? {
let indexes = sections.compactMap({ $0.indexTitle })
guard !indexes.isEmpty else {
return nil
}
return indexes
}
public func tableView(_ tableView: UITableView, sectionForSectionIndexTitle title: String, at index: Int) -> Int {
return sections.firstIndex(where: { $0.indexTitle == title }) ?? 0
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels