I have developed a macOS personal finance app in SwiftUI that uses NSTableViews and NSOutlineViews through the NSViewControllerRepresentable interface between SwiftUI and AppKit.
I have found that the AppKit view capabilities are far superior to anything I can create using SwiftUI lists plus they run faster and support TypeSelect. Passing data into the Appkit ViewControllers is straightforward but getting information out seems to be less so.
Apple developer documentation suggests that I should use a Coordinator class and I have tried to do so but to no avail. The delegated method that I need (func tableViewSelectionDidChange(_ notification: Notification)) fails to run (from inside my Coordinator class).
For the moment I am exchanging data and actions using NotificationCenter.default and that is working well but I am keen to use the 'official' method. I have found a macOS application that uses Coordinator successfully (at https://www.markusbodner.com/til/2021/02/08/multi-line-text-field-with-swiftui-on-macos/), but I cannot get my Coordinator class to work as a NSTableViewDelegate even though it builds and runs without errors (Xcode 12.4).
All I want to do for a start is to get an NSViewController that contains a NSTableView to pass the NSTableView.selectedRow into its parent SwiftUI view via a Coordinator, whenever the user selects a new row in the NSTableView. Can anyone help (with some sample code, if possible, please)?