I’m unable to determine the right way to detect a protracted press on a tabItem
.
Right here is a few instance code:
struct ContentView: View {
var physique: some View {
TabView {
Textual content("Menu")
.tabItem {
Label("Menu", systemImage: "checklist.sprint")
}
.onLongPressGesture {
print("Lengthy pressed!")
}
Textual content("Order")
.tabItem {
Label("Order", systemImage: "sq..and.pencil")
}
}
}
}
On this case I see “Lengthy pressed!” printed solely once I lengthy press within the menu view itself. If I transfer the gesture modifier to Label
, I see nothing printed, however as an alternative see this within the debugger once I lengthy press the menu picture:
<0x105106690> Gesture: System gesture gate timed out.
How can I do that?
EDIT: I noticed this publish: Why am I getting this: [SystemGestureGate] <0x102210320> Gesture: System gesture gate timed out with the identical debugger message. Apparently it has to do with detecting gestures close to the underside of the display.