I am trying to implement a Picker embedded inside a Menu in SwiftUI, following this post. However, there seems to be a bug where the picker does not initially show a checkmark next to the currently selected option when embedded inside a Menu.
Menu {
Picker("Unit", selection: $food.servingSize.unit) {
ForEach(units) { unit in
Text(unit.name).tag(unit)
}
}
} label: {
Text(food.servingSize.unit.shorthand)
}
However, if I don't use Menu and just the Picker by itself instead, the default selection works as expected:
Picker("Unit", selection: $food.servingSize.unit) {
ForEach(units) { unit in
Text(unit.name).tag(unit)
}
}
.pickerStyle(.menu)
Obviously I want to use the Menu in order to change what is being displayed after selection from the Picker. What am I missing here?

