FunctionalTableData icon indicating copy to clipboard operation
FunctionalTableData copied to clipboard

Switch `height` to a function and not a variable

Open adam-felix-shopify opened this issue 3 years ago • 0 comments

These changes allow for header and footer width to be passed to the functional table data. More specifically, FunctionalTableData.Delegate's UITableViewDelegate implemenation now uses tableView's width in tableView(_:heightForHeaderInSection:) and tableView(_:heightForFooterInSection).

We achieved this functionality while maintaining backwards compatibility by adding a protocol method to both TableHeaderFooterConfigType and TableHeaderFooterStateType called func height(given width: CGFloat) -> CGFloat?. If this method returns nil, then the table view delegate methods will use the current height property already defined, otherwise it will use the provided by the new methods.

Each protocol provides a public default implemenation so that library consumers need not implement this method unnecessarily.

adam-felix-shopify avatar Aug 26 '22 14:08 adam-felix-shopify