I have checked everything but this doesn't appear to work. Here is the part of the code used for that - simplified my view looks like this:
ScrollViewReader { scroll in
List(voices) { item in
Button(item.title) { }
.fontWeight(item.id == selected ? .bold : .regular)
}
.onAppear() {
scroll.scrollTo(selected, anchor: .center)
}
}
selected
is properly shown as bold, so the value is proper. But the app doesn't scroll to it. I have tried various things like dispatching on main thread and even dispatching on main thread after 1 second, but nothing helps.
However that scroll code works when being called from the Button.
Is this a bug on watchOS?
I can’t edit but to note that selected is assigned in OnAppear so it has a proper value when being Called for scrolling.