SwiftUI: how to handle BOTH tap & long press of button?

前端 未结 8 1204
刺人心
刺人心 2020-12-15 06:59

I have a button in SwiftUI and I would like to be able to have a different action for \"tap button\" (normal click/tap) and \"long press\".

Is that possible in Swift

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-15 07:53

    As a follow up, I had the same issue and I tried all of these answers but didn't like how they all worked. I ended up using a .contextMenu it was way easier and produces pretty much the same effect.

    Check link here

    and here is an example

提交回复
热议问题