diff --git a/Static/DataSource.swift b/Static/DataSource.swift index dea8305..fbb4c96 100644 --- a/Static/DataSource.swift +++ b/Static/DataSource.swift @@ -204,7 +204,7 @@ extension DataSource: UITableViewDataSource { } public func tableView(_ tableView: UITableView, heightForHeaderInSection sectionIndex: Int) -> CGFloat { - return section(at: sectionIndex)?.header?.viewHeight ?? UITableViewAutomaticDimension + return section(at: sectionIndex)?.header?.viewHeight ?? 0 } public func tableView(_ tableView: UITableView, titleForFooterInSection sectionIndex: Int) -> String? { @@ -216,7 +216,7 @@ extension DataSource: UITableViewDataSource { } public func tableView(_ tableView: UITableView, heightForFooterInSection sectionIndex: Int) -> CGFloat { - return section(at: sectionIndex)?.footer?.viewHeight ?? UITableViewAutomaticDimension + return section(at: sectionIndex)?.footer?.viewHeight ?? 0 } public func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { diff --git a/Static/Section.swift b/Static/Section.swift index 36c3a27..a6f95a8 100644 --- a/Static/Section.swift +++ b/Static/Section.swift @@ -27,8 +27,11 @@ public struct Section: Hashable, Equatable { } } - var viewHeight: CGFloat? { - return _view?.bounds.height + var viewHeight: CGFloat { + switch self { + case .title: return UITableViewAutomaticDimension + case .view(let extremityView): return extremityView.bounds.height + } } }