Search Hosts + search animations + reload table after filter manipulations

This commit is contained in:
relikd
2020-06-05 14:27:41 +02:00
parent 80829ad015
commit 23eab2310f
8 changed files with 205 additions and 73 deletions

View File

@@ -35,6 +35,19 @@ extension UITableView {
func safeMoveRow(_ from: Int, to: Int) {
isFrontmost ? moveRow(at: IndexPath(row: from), to: IndexPath(row: to)) : reloadData()
}
/// Scroll table to top (while respecting `contentInset`)
func scrollToTop(animated: Bool) {
let top: CGFloat
if #available(iOS 11.0, *) {
top = adjustedContentInset.top
} else {
top = contentInset.top
}
if contentOffset.y != -top {
setContentOffset(.init(x: 0, y: -top), animated: animated)
}
}
}