Reputation: 80
Getting Pan gesture on GMSMapView object won't return anything. I don't know if this will work. However on the override delegation on didChange function won't do much, because I wanted to get the .began/.changed/.ended state just like on a UIPanGestureRecognizer.
Adding a gesture recognizer on GMSMapView object but it won't return any of the gestures state.
//Initializitaion
let panGesture = UITapGestureRecognizer(target: self, action: #selector(self.handlePan(recognizer:)))
mapView?.addGestureRecognizer(panGesture)
mapView?.isUserInteractionEnabled = true
//function
@objc func handlePan(recognizer: UIPanGestureRecognizer){
var animator = UIViewPropertyAnimator()
switch recognizer.state {
case .began:
print("began")
case .changed:
print("changed")
case .ended:
print("ended")
default:
print("none")
}
}
Upvotes: 1
Views: 215
Reputation: 379
You should set this to false mapView.settings.consumesGesturesInView = false
When this is set to true
(by default), all the gestures are handled by the GMSMapView.
You can set it to false to handle this by yourself. Because pan gesture
is handled by default.
Check the documentation : Google Maps Documentation
May I ask for what purpose you want to handle all the gestures?
Upvotes: 3