How would you scroll to a selected row in a Table?
I have implemented a find capability that successfully selects row(s) in a Table.
Sadly, often the selections aren't immediately visible, so users have to scroll up/down to confirm (my pinky promise isn't enough).
How would you (in effect or reality) scroll to a selected row?
Impl Dtl
Data
is@Identifiable
- Selection is
@State selection = Set(<Data.Id>);
- Table is
Table(data, selection: $selection){ TableColumn("Col"){ ... }
- A find
Button
successfullyselection.insert(foundId)
The table shows the selected result either on screen or after user scroll. It's the after user scroll thing...who has time to for that? :)
All pretty vanilla stuff (I am enjoying SwiftUI a bunch).
Hopes + Dreams
The find Button
is intended to grow selection
- it selects a chunk of data, and then the user can decide to grow that chunk by clicking the find Button
again.
Ideally, I'd like the Table
to scroll to the first selection in each iteration of the "selection chunk", but honestly, auto-scrolling to selection.first
at this point would be fantastic.
Any tips or tricks? I am new and stumped. Thx (MacOS, for now)