Skip to content

Commit 35574d7

Browse files
committed
grouped tableview fix
1 parent c8d7c1a commit 35574d7

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

LayoutOps/LayoutOps/NodesDisplayAdapter.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55

66
import Foundation
77

8-
public final class NodesSequenceDisplayAdapter<Index: Hashable> {
8+
final class NodesSequenceDisplayAdapter<Index: Hashable> {
99

1010
private let itemNode: (Index, Bool)-> RootNode
1111

1212
private var cache = [Index: RootNode]()
1313

14-
public init(itemNode: @escaping (Index, Bool)-> RootNode) {
14+
15+
init(itemNode: @escaping (Index, Bool)-> RootNode) {
1516
self.itemNode = itemNode
1617
}
1718

LayoutOps/LayoutOps/UIKit/TableViewNodesDisplayAdapter.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ public final class TableViewNodesDisplayAdapter {
3939
//MARK: - footers
4040

4141
public func tableView(_ tableView: UITableView, estimatedHeightForFooterInSection section: Int) -> CGFloat {
42-
return footerNodeSequence.estimatedSize(for: section, size: CGSize(width: tableView.bounds.size.width, height: 0)).height
42+
let h = footerNodeSequence.estimatedSize(for: section, size: CGSize(width: tableView.bounds.size.width, height: 0)).height
43+
if isAlmostEqual(left: h, right: 0) {
44+
return 2
45+
} else {
46+
return h
47+
}
4348
}
4449

4550
public func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
@@ -59,7 +64,12 @@ public final class TableViewNodesDisplayAdapter {
5964
//MARK: - headers
6065

6166
public func tableView(_ tableView: UITableView, estimatedHeightForHeaderInSection section: Int) -> CGFloat {
62-
return headerNodeSequence.estimatedSize(for: section, size: CGSize(width: tableView.bounds.size.width, height: 0)).height
67+
let h = headerNodeSequence.estimatedSize(for: section, size: CGSize(width: tableView.bounds.size.width, height: 0)).height
68+
if isAlmostEqual(left: h, right: 0) {
69+
return 2
70+
} else {
71+
return h
72+
}
6373
}
6474

6575
public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {

0 commit comments

Comments
 (0)