NavigationSplitView + inspector causes Sidebar state issues on Mac Catalyst

Hi everyone!

I've encountered an issue on Mac Catalyst: using the latest inspector modifier causes abnormal Sidebar and Columns state in NavigationSplitView.

Sample Code:

struct ContentView: View {
    @State private var isPresented = false
    
    var body: some View {
        NavigationSplitView {
            List {
                ForEach(0..<20, id: \.self) { item in
                    Text("Item \(item)")
                }
            }
        } content: {
            List {
                ForEach(0..<20, id: \.self) { item in
                    Text("Item \(item)")
                }
            }
        } detail: {
            List {
                
            }
        }
        .inspector(isPresented: $isPresented) {
            Form {
                
            }
        }
    }
}

Steps to reproduce:

  1. Xcode 16 beta 7, create a new iOS project
  2. Paste the code above
  3. Enable Mac Catalyst
  4. Run on Mac (macOS 15 beta 9)
  5. Press Command+N three times to open 3 new windows
  6. Click the Sidebar Toggle button
  7. The issue occurs (see screenshot below)

Through testing, I found that as long as the inspector modifier is attached, the issue occurs.

Also, the problem only appears in the 3rd and subsequent newly opened windows—the first two windows work as expected.

FB20061521

NavigationSplitView &#43; inspector causes Sidebar state issues on Mac Catalyst
 
 
Q