So my game uses swipe gestures, in my didMoveToView() function I have these gestures initialized:
let swipeRight = UISwipeGestureRecognizer()
You are removing all kind of gesture, try this:
if([recognizer isKindOfClass:[UISwipeGestureRecognizer class]]) {
[self removeGestureRecognizer:recognizer];
}
Hope this helps.. :)
Replace UIGestureRecognizer
with UISwipeGestureRecognizer
if that's what you want to remove.
extension SKView {
func removeAllGestureRecognizers() {
if let objects = gestureRecognizers {
for object in objects {
if let gestureRecognizer = object as? UIGestureRecognizer {
removeGestureRecognizer(gestureRecognizer)
}
}
}
}
}
The following removes all swipe gesture recognizers from the view:
override func willMoveFromView(view: SKView) {
if let gestures = view.gestureRecognizers {
for gesture in gestures {
if let recognizer = gesture as? UISwipeGestureRecognizer {
view.removeGestureRecognizer(recognizer)
}
}
}
}