Skip to content

Commit 981a3c5

Browse files
committed
Add support for specifying section header and footer titles through TableViewDiffableDataSource subclasses
1 parent 328894d commit 981a3c5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Sources/UIKit/TableViewDiffableDataSource.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,28 @@ open class TableViewDiffableDataSource<SectionIdentifierType: Hashable, ItemIden
9494
return core.numberOfItems(inSection: section)
9595
}
9696

97+
/// Returns the title for the specified section's header.
98+
///
99+
/// - Parameters:
100+
/// - tableView: A table view instance managed by `self`.
101+
/// - section: An index of section.
102+
///
103+
/// - Returns: The title for the specified section's header, or `nil` for no title.
104+
open func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
105+
return nil
106+
}
107+
108+
/// Returns the title for the specified section's footer.
109+
///
110+
/// - Parameters:
111+
/// - tableView: A table view instance managed by `self`.
112+
/// - section: An index of section.
113+
///
114+
/// - Returns: The title for the specified section's footer, or `nil` for no title.
115+
open func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
116+
return nil
117+
}
118+
97119
/// Returns a cell for row at specified index path.
98120
///
99121
/// - Parameters:

0 commit comments

Comments
 (0)