How do you detect a SwiftUI touchDown event with no movement or duration?

You can use the .updating modifier like this: struct TapTestView: View { @GestureState private var isTapped = false var body: some View { let tap = DragGesture(minimumDistance: 0) .updating($isTapped) { (_, isTapped, _) in isTapped = true } return Text(“Tap me!”) .foregroundColor(isTapped ? .red: .black) .gesture(tap) } } Some notes: The zero minimum distance makes … Read more

In Flutter, how can a positioned Widget feel taps outside of its parent Stack area?

This behavior occurs because the stack checks whether the pointer is inside its bounds before checking whether a child got hit: Class: RenderBox (which RenderStack extends) bool hitTest(BoxHitTestResult result, { @required Offset position }) { … if (_size.contains(position)) { if (hitTestChildren(result, position: position) || hitTestSelf(position)) { result.add(BoxHitTestEntry(this, position)); return true; } } return false; } … Read more

UINavigationController Interactive Pop Gesture Not Working?

I have found that when using custom back buttons, the interactive pop gesture stops working (my take is that Apple cannot foresee how your custom back button will behave, so they disable the gesture). To fix this, as other mentioned before, you can set the interactivePopGestureRecognizer.delegate property to nil. In Swift, this can easily be … Read more

Detect shake gesture IOS Swift

Swift3 ios10: override func viewDidLoad() { super.viewDidLoad() self.becomeFirstResponder() // To get shake gesture } // We are willing to become first responder to get shake motion override var canBecomeFirstResponder: Bool { get { return true } } // Enable detection of shake motion override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) { if motion == … Read more