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

后端 未结 6 817
无人及你
无人及你 2020-12-19 02:21

I\'m trying to detect when a finger first makes contact with a view in SwiftUI. I could do this very easily with UIKit Events but can\'t figure this out in SwiftUI.

I

6条回答
  •  一向
    一向 (楼主)
    2020-12-19 02:53

    Actually, @eli_slade, all you need is this:

    LongPressGesture().onChanged {_ in print("down") }
    

提交回复
热议问题