Skip to content

Commit f1c2b90

Browse files
authored
Merge pull request #29 from jdanthinne/master
Add missing sectionIndexTitles method for tableviews
2 parents 203c0f1 + 7e96a25 commit f1c2b90

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Sources/UIKit/TableViewDiffableDataSource.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,24 @@ open class TableViewDiffableDataSource<SectionIdentifierType: Hashable, ItemIden
182182
// Empty implementation.
183183
}
184184

185+
/// Return list of section titles to display in section index view (e.g. "ABCD...Z#").
186+
///
187+
/// - Parameters:
188+
/// - tableView: A table view instance managed by `self`.
189+
///
190+
/// - Returns: The list of section titles to display.
191+
open func sectionIndexTitles(for tableView: UITableView) -> [String]? {
192+
return nil
193+
}
194+
195+
/// Tell table which section corresponds to section title/index (e.g. "B",1)).
196+
///
197+
/// - Parameters:
198+
/// - tableView: A table view instance managed by `self`.
199+
/// - title: The title as displayed in the section index of tableView.
200+
/// - section: An index number identifying a section title in the array returned by sectionIndexTitles(for tableView:).
201+
///
202+
/// - Returns: The list of section titles to display.
185203
open func tableView(_ tableView: UITableView, sectionForSectionIndexTitle _: String, at section: Int) -> Int {
186204
return section
187205
}

0 commit comments

Comments
 (0)