Post

Replies

Boosts

Views

Activity

Reply to SwiftUI macOS Table refresh not keeping selection
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 []
Jan ’24
Reply to invalid mode 'kCFRunLoopCommonModes'
NB. RESOLVED below is now working Have this same message in SwiftUI and the attached method isn't called. Is it something I'm doing wrong? 	Toggle(isOn: self.$isOn) {             EmptyView()   } .onChange(of: self.isOn) { _ in             print("**DEBUG - \(self.isOn)")    } System: Xcode 12.1 GM seed 6th Gen iPad mini - iPadOS 14.1
Oct ’20