Post

Replies

Boosts

Views

Activity

Swiftui App - recognize one of two Gestures
My case is simple - tap or double tap. Code below adds a gesture recognizer to each item index in the ForEach loop of a basic List (no Nav wrapper). It returns a single Tap properly but on a double tap it returns both the 1st the double tap then the single tap. It seems I need something more like .exclusiveGesture but there is none. Any suggestions appreciated (I have a wasteful workaround using an otherwise needed State bool to avoid taking the second action) I need exclusivity for taps (.exclusiveGesture would be just right if there were one) Thanks for any pointers.   DefaultRowView(row: model.displayedStore[index], onDisplayedList: true)                                 .gesture(                                     TapGesture(count:2)                                         .onEnded({                                             rowTappedIndexValue = index                                             print("%%% Double Tap DisplayedStore: \(index)")                                         })) //.gesture                                 .simultaneousGesture(TapGesture()                                 .onEnded({                                     rowTappedIndexValue = index                                     print("*** Tap DisplayedStore: \(index)")                                     //                                             self.isActiveOptionsSheetShowing.toggle()                                     model.removeFromDisplayStore (indexOfItemToRemove: rowTappedIndexValue)                    })) //.gesture
1
0
1.2k
Sep ’20