I have a list and when I insert an item, i want to the list to scroll to the bottom automatically when my @ObservedObject
changed.
There is my actual View code :
struct DialogView: View {
@ObservedObject var viewModel = DialogViewModel()
var body: some View {
List {
ForEach(self.viewModel.discussion, id: .uuid) {
Text($0.content)
}
}.animation(Animation.easeOut)
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…