I'm working with Swift 3, Xcode and SpriteKit.
I have two gestures: UIPanGestureRecognizer and UIPinchGestureRecognizer
let pinchGesture = UIPinchGestureRecognizer()
let panGesture = UIPanGestureRecognizer()
override func didMove(to view: SKView)
{
let pinchGesture = UIPinchGestureRecognizer(target: self, action: #selector(GameScene.pinchFunction))
view.addGestureRecognizer(pinchGesture)
let panGesture = UIPanGestureRecognizer(target: self, action: #selector(GameScene.panFunction))
view.addGestureRecognizer(panGesture)
}
I want to be able to pinch the screen, and while pinching to move my two fingers, so I want the two gestures to work simultaneously. But I can't manage to do it. Here's what I tried :
func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return true
}
What is the correct way to do it ?