Commit 18d0b1f6 authored by Toby Brennan's avatar Toby Brennan
Browse files

Minor fix to scrollPositionSetter

parent de016a2e
Showing with 3 additions and 4 deletions
+3 -4
......@@ -320,9 +320,8 @@ public struct ASTableView<SectionID: Hashable>: UIViewControllerRepresentable, C
let contentInsets = tableViewController?.tableView.contentInset ?? .zero
tableViewController?.tableView.setContentOffset(CGPoint(x: 0, y: contentInsets.top), animated: animated)
case .bottom:
let contentSize = tableViewController?.tableView.contentSizePlusInsets ?? .zero
let visibleHeight = tableViewController?.tableView.frame.height ?? .zero
tableViewController?.tableView.setContentOffset(CGPoint(x: 0, y: contentSize.height - visibleHeight), animated: animated)
let maxOffset = tableViewController?.tableView.maxContentOffset ?? .zero
tableViewController?.tableView.setContentOffset(maxOffset, animated: animated)
}
DispatchQueue.main.async {
self.parent.scrollPositionSetter?.wrappedValue = nil
......
......@@ -15,6 +15,6 @@ extension UIScrollView
{
CGPoint(
x: max(0, contentSizePlusInsets.width - bounds.width),
y: max(0, contentSizePlusInsets.height + safeAreaInsets.top - bounds.height))
y: max(0, contentSizePlusInsets.height - safeAreaInsets.top - bounds.height))
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment