TabView layout issue interfering with selection binding

I've noticed that under specific conditions, the TabView encounters a layout issue, which appears to mess with its selection. Below is a minimal example:

struct ContentView: View {
    var body: some View {
        NavigationView {
            List {
                TabView(selection: .constant(1)) {
                    ForEach(0..<3) { i in
                        Text("displaying tab \(i)").tag(i)
                    }
                }.tabViewStyle(.page)
            }.listStyle(.plain)
        }
    }
}

This will throw the following layout warning:

testtabview[62158:2485347] [Warning] Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a table view cell's content view. We're considering the collapse unintentional and using standard height instead. Cell: <SwiftUI.ListTableViewCell: 0x7fe07903ba00; baseClass = UITableViewCell; frame = (0 0; 414 52); autoresize = W; layer = <CALayer: 0x6000031b5360>>

If this happens, it will change the TabView selection a different, undesired value (in the above case, it will select the [0]th tab instead of [1]).

I've only been able to reproduce this with the following view hierarchy (though they don't need to be direct decendents): NavigationView -> List (with plain style modifier) -> TabView (with page style modifier)

Does anyone know how I can make this work? Is this a bug in SwiftUI?

(ios 15, xcode 13.0 beta 3)

Thanks

Answered by HamishGilkison1 in 689137022

Resolved by updating to XCode 13

Accepted Answer

Resolved by updating to XCode 13