'Gestures flickering in SKScene

Here is a screen capture from my SKScene. Please someone help me fix this issue. I'll give more info if you need it.

var previousCameraPoint = CGPoint.zero

@objc func panGestureAction(_ sender: UIPanGestureRecognizer) {
    guard let camera = self.camera else {
        return
    }

    switch sender.state {
    case .began:
        previousCameraPoint = camera.position
    @unknown default:
        break
    }

    let translation = sender.translation(in: self.view)
    let newPosition = CGPoint(
        x: previousCameraPoint.x + translation.x * -5,
        y: previousCameraPoint.y + translation.y * 5
    )
    camera.position = newPosition
}

Gesture issue



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source