Full Screen Sidebar with SwiftUI on Big Sur

Adopt the new look of macOS covered how to create a full screen sidebar in AppKit, but I'm not able to figure out how to accomplish this with SwiftUI. Any ideas as to what I'm missing?

Code Block swift
@main
struct MyApp: App {
  var body: some Scene {
WindowGroup {
      ContentView()
}
  }
}
struct ContentView: View {
  @State var strings: [String] = ["A", "B", "C"]
  @State var selection: String?
  var body: some View {
  HSplitView {
      List(selection: $selection) {
        ForEach(strings, id: \.self) { string in
          Text(string)
      }
    }
.listStyle(SidebarListStyle())
    VStack {
        Spacer()
        Text(selection ?? "<none>")
          .frame(idealWidth: 100, maxWidth: .infinity, alignment: .center)
     Spacer()
}
    }
  }
}


I already filed FB7776520 in case it's not possible, but I'm assuming I'm missing something since it's a marquee feature. Thanks!

Update: If I replace HSplitView with NavigationView it works as expected. 🤦‍♂️
Answered by Frameworks Engineer in 615482022
As you discovered, NavigationView knows how to provide the full-height sidebar appearance for its first child view.
Accepted Answer
As you discovered, NavigationView knows how to provide the full-height sidebar appearance for its first child view.
Did you happen to figure out how to show a toggle sidebar button on macOS with SwiftUI?

Full Screen Sidebar with SwiftUI on Big Sur
 
 
Q