Picker selection when declared in toolbar Menu seems to be broken (Xcode 14 beta 5)

When selecting an option in Picker declared in Menu in toolbar with this code:

struct ContentView: View {
    @State private var option: Int = 0
    var body: some View {
        NavigationStack {
            Text("Hello, World")
                .toolbar {
                    ToolbarItem {
                        Menu {
                            Picker("", selection: $option) {
                                Text("Option 0").tag(0)
                                Text("Option 1").tag(1)
                            }
                        } label: {
                            Image(systemName: "star")
                        }
                    }
                }
        }
    }
}

there is no visible change in selecton (checkmark is on the initial option). But the actual change happens - 'option' variable changes.

In Xcode 13.4.1 / iOS 15.5 the same code works well (for NavigationView of course).

I think this is certainly a bug.

Answered by Alex_Vorobiev in 724124022

OK. It seems to be fixed in iOS 16 beta 6.

Accepted Answer

OK. It seems to be fixed in iOS 16 beta 6.

Picker selection when declared in toolbar Menu seems to be broken (Xcode 14 beta 5)
 
 
Q