is there a way to get all the section header views that are visible?
something similar to UITableView\'s visibleCells instance method..
Swift 4+ Clean and simple, without duplicities:
extension UITableView {
var visibleHeaderViews: [UITableViewHeaderFooterView] {
guard let visibleSectionsIndexPaths = indexPathsForVisibleRows?.compactMap({ $0.section }) else { return [] }
return Set(visibleSectionsIndexPaths).compactMap { headerView(forSection: $0) }
}
}