Created
August 6, 2022 16:50
-
-
Save atrinh0/3df23140ba39df05692befb7153c8285 to your computer and use it in GitHub Desktop.
SwiftUI menu picker selection issue
This video shows selecting the different values in the menu picker within the toolbar updates the selection as shown in the middle of the screen, however the picker menu selection does not change. (The tick is still selecting the first item)
Simulator.Screen.Recording.-.iPhone.13.Pro.Max.-.2022-08-06.at.17.47.47.mp4
Raised FB11104547
Issue still exists in Xcode 14 beta 5
A workaround, https://twitter.com/DanielKasaj/status/1559453531760992257
Setting the .id(UUID())
on the menu fixes the selection issue.
Menu {
Picker(selection: $selection) {
ForEach(SortOrder.allCases) {
Text($0.rawValue)
.tag($0)
}
} label: { }
} label: {
Text("Sort by")
}
.id(UUID())
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The selection of a picker within the toolbar does not update to show the selected value.
This is working on Xcode 13.4.1, and from what I recall, it was also working on Xcode 14 beta 3.