tabViewBottomAccessory selective hidden bug

import SwiftUI



struct ContentView: View {

    @State private var selection = 1



    var body: some View {

        TabView(selection: $selection) {

            Tab("1", systemImage: "1.circle", value: 1) {

                Text("Tab 1")

            }



            Tab("2", systemImage: "2.circle", value: 2) {

                Text("Tab 2")

            }

        }

        .tabViewBottomAccessory {

            if selection == 1 {

                Text("Bottom Bar for Tab 1")

            }

        }

    }

}

With this structure, I'm supposing when I select tab 2, the bottom accessory will be hidden, but it is not hidden for the first time, after I click back to tab 1, then click tab 2, it is hidden.

I think this is a bug?

tabViewBottomAccessory selective hidden bug
 
 
Q