Skip to content

Commit

Permalink
Merge pull request #108 from nealyoung/extremity-height-fix
Browse files Browse the repository at this point in the history
Fix display of empty headers on iOS 11
  • Loading branch information
hyperspacemark authored Aug 8, 2017
2 parents e002d86 + f9ef0e6 commit 2071110
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Static/DataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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? {
Expand All @@ -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 {
Expand Down
7 changes: 5 additions & 2 deletions Static/Section.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit 2071110

Please sign in to comment.