Why @Bindable for the viewModel? Since you are using the Observation framework, make the viewModel @State var viewModel = TableViewModel (this is if you want to initialize the viewModel elsewhere and pass it in. Otherwise use @State private var viewModel = TableViewModel()
The reason why it isn't keeping the selection is because your view is probably redrawn and the viewModel is reinitialized, on initialization you set selections to []
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: