Whats the Appkit equivalent of SwiftUI's NavigationSplitView?

How do I implement the same Navigation split view with a side bar in Appkit?

Basically I have this code:

import SwiftUI

struct ContentView: View {
    var body: some View {
        NavigationSplitView {
            // Sidebar
            List {
                NavigationLink("Item 1", value: "Item 1 Details")
                NavigationLink("Item 2", value: "Item 2 Details")
                NavigationLink("Item 3", value: "Item 3 Details")
            }
            .navigationTitle("Items")
        } content: {
            // Main content (detail view for selected item)
            Text("Select an item to see details.")
                .padding()
        } detail: {
            // Detail view (for the selected item)
            Text("Select an item from the sidebar to view details.")
                .padding()
        }
    }
}


struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

and wanted to somehow convert it to Appkit. I tried to use an NSSplitViewController but I still don't have that side bar and that button to collapse it, how do I go about this?

The sidebar is the result of using the Source List style for your navigation table view.

You have to add the sidebar toggle button yourself. Set the "isNavigational" property to true so that it appears in a navigation location in the titlebar.

I think there is some sort of "toggleSidebar" operation. There is a menu item for it. But the built-in operation isn't animated. For an animated collapse, you'll need to set the "isCollapsed" property of first NSSplitViewItem, using the "animator()" proxy, of course.

Rest assured, it is much more complicated than it sounds. There's a reason why SwiftUI is so popular. If you hit the wall on what SwiftUI offers, you have to make some hard choices.

Whats the Appkit equivalent of SwiftUI's NavigationSplitView?
 
 
Q