How to detect touch inputs in SKScene on watchOS SpriteKit?

45 Views Asked by At

I'm trying to display a SKScene inside SwiftUI on watchOS and detect touch events.

    var body: some View {
        GeometryReader { reader in
            SpriteView(scene: GameScene(size: reader.size))
                .focusable()
        }
    }

Works fine, now i want to detect touches in the scene, but the method touchesBegan is not available in watchOS. How do i accomplish this?

    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        <#code#>
    }

I looked at the documentation which says something about WKTapGestureRecognizer but im not sure how to use this since i'm using SwiftUI

0

There are 0 best solutions below