Post

Replies

Boosts

Views

Activity

Reply to Selection disappearing in NSTableView inside SwiftUI
I never got an answer, but I solved my problem by redesigning the table to be expressible as a SwiftUI List, which does away with the awkward interaction with NSTableView. I got a cleaner design in some ways, but I lost a couple of things, particularly the ability to shade alternate rows to make it easier to read, and sorting by columns. Neither is a show-stopper, so I'm going with what I've come up with.
Mar ’21
Reply to How to make a list with a filter field in SwiftUI on Mac
I eventually figured out that the important thing I was missing was "id: \.self" in the List statement. I'd understood the documentation to say that wasn't necessary if the content conformed to Identifiable, but I was mistaken, and you need to specify the identifier. Your solution is interesting, and worth thinking about as I continue to work on the project.
Mar ’21
Reply to Selection disappearing in NSTableView inside SwiftUI
Since there's been no reply, here's most of the code for the NSViewControllerRepresentable class: Swift struct LayoutsTableView: NSViewControllerRepresentable { typealias NSViewControllerType = LayoutsTableController @Binding var layoutsList: [LayoutData]     @Binding var selectedIndex: Int func makeNSViewController(context: Context) - LayoutsTableController { let theTable = LayoutsTableController(nibName: "LayoutsTable", bundle: Bundle.main) theTable.layoutList = layoutsList         theTable.tableDelegate = context.coordinator // So that the table can set its delegate after it appears         context.coordinator.tableController = theTable return theTable }     func makeCoordinator() - Coordinator {         return Coordinator(self)     } func updateNSViewController(_ nsViewController: LayoutsTableController, context: Context) { nsViewController.layoutsTable.reloadData() }     final class Coordinator: NSObject, NSTableViewDelegate {         var parentView: LayoutsTableView         var tableController: LayoutsTableController?         init(_ parent: LayoutsTableView) {             parentView = parent         }         // MARK: Table Delegate methods         func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) - NSView? { // returns the appropriate view         }         func tableViewSelectionDidChange(_ notification: Notification) {             let selectedRow = tableController?.layoutsTable.selectedRow ?? -1             parentView.selectedIndex = selectedRow         }     } } Any clues, anyone?
Mar ’21
Reply to Different AppleScript problem with Catalina?
No answers?I've tried other methods of doing the move, such as avoiding the helper application and calling /bin/mv or /bin/cp directly in the shell script, but these apparently end up being sandboxed and so unable to move files. Trying to make the AppleScript into a 'tell application "Finder"' also fails, even if I give the app the capability of sending Apple events to other applications. Do I need to try constructing an actual Apple event and sending that? I've also tried giving both the main app and the helper app full disk access in System Preferences, but that hasn't helped.So, am I totally out of luck with Catalina? Is there a way for an app to move files into a folder which requires administrator privileges? Or do I have to tell users to do it with Finder, which some struggled to do?John
Dec ’19