1

I have a WKInterfaceButton in Xcode and when I configure the action for it, it only executes it when the tap has ended, that is, when my finger is lifted.

@IBAction func kickButton() {
       //Action for this button
}

I want to be able to perform the same action but when the touch has just started, like the pressesBegan action in iOS applications. I don't know if there is a way to do this.

Alex S.
  • 65
  • 8

1 Answers1

1

You could replace your button with a tap gesture recognizer and then target a function similar to this:

func handlePress(sender: WKTapGestureRecognizer) {
    if sender.state == .began {
        // code for when press began
    }
}
Zachary Bell
  • 559
  • 4
  • 18