I got my xcode to update this morning. It prompted me to update and so I did. Since then, I have issues with Pickers on my app. I have two Pickers next to each other horizontally. However the dragGesture on each is off, by large!
HStack(alignment: .center, spacing: 0) {
Spacer()
HStack(spacing: 8) {
Picker("selectionHours", selection: $hour) {
ForEach(selectionHours, id: \.self) {
Text($0)
.font(.custom("Nunito-SemiBold", size: 28, relativeTo: .body))
}
}
.labelsHidden()
.frame(maxWidth: 60, maxHeight: 40)
.clipShape(RoundedRectangle(cornerRadius: 15.0))
.clipped()
Text("hours_short")
.font(.custom("Nunito-SemiBold", size: 22, relativeTo: .body))
}
.foregroundColor(Color.primary)
Spacer()
HStack(spacing: 8) {
Picker("selectionMinutes", selection: $minute) {
ForEach(selectionminutes, id: \.self) { index in
Text(index)
.font(.custom("Nunito-SemiBold", size: 28, relativeTo: .body))
}
}
.labelsHidden()
.frame(maxWidth: 60, maxHeight: 40)
.clipShape(RoundedRectangle(cornerRadius: 15.0))
.clipped()
Text("minutes_short")
.font(.custom("Nunito-SemiBold", size: 22, relativeTo: .body))
.foregroundColor(Color.primary)
}
.foregroundColor(Color.primary)
Spacer()
}
.frame(height: 70)
While trying to drag on the left picker, it scrolls on the right one. If I remove: .clipped
you can see the "scrollable" area that is overlapping. This issue started as I mentioned this morning with an update, now the simulator is running ios 15. It feels like a ios 15 bug. I have no access to a physical ios device and cannot test it at the moment on a physical device to see if it's a simulator/xcode bug or swiftui bug.
There was a similar issue (with wheel picker) reported on the forum a few days ago.
Could you have a look at it and see if it gives clues to solve your problem ?
https://developer.apple.com/forums/thread/690610
But you have many things to display in horizontal stack. Try to rotate the device to see if the problem still there.