Ok, the issue is also that I have a complex attributed textview that does a lot of processing to render a comment(replacing various tags, setting font, posts referencing etc) Should have mentioned that
I added view.updateIfNeeded and moved replies out as suggested by @StevenPeterson. Feels better now
+some animations on scroll
Previously instruments showed a few micro hangs. Couldn't see any issues. Will try to dedicate more time to get familiar with it.
func scrollToBottom() {
guard !viewModel.processedPosts.isEmpty else { return }
let last = viewModel.processedPosts.last!.post.num
scrollProxy?.scrollTo(last, anchor: .bottom)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.08) {
withAnimation(.easeOut(duration: 0.2)) {
scrollProxy?.scrollTo(last, anchor: .bottom)
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: