You used to be able to put two wheel Pickers
side-by-side in an HStack
, if you used .frame(...)
to set the width, along with .clipped().
Example code from previous question here: https://developer.apple.com/forums/thread/127028
HStack(spacing: 0) {
Picker(selection: $choice1, label: Text("C1")) {
ForEach(0..<10) { n in
Text("\(n) a").tag(n)
}
}
.pickerStyle(.wheel)
.frame(minWidth: 0)
.clipped()
// repeat with second Picker
}
This is not working for me now in iOS 15. The views still appear side by side, but the touch area seems to overlap. When you try to adjust the first wheel, it spins the second one. I can move the first wheel, if I touch way over to the leading side of the screen.
(I had to add the explicit Picker style. It seems like defaulting to .menu
also started in iOS 15. ?)
but the touch area seems to overlap.
Seems to be the same issue as this thread:
Limit width of wheel style picker on iOS
Have you tried using .compositingGroup()
as shown in it?