I am trying to get the CLLocationCoordinate2D object from the tapped location in a google map view. But it always return me -180.0, -180.0 as lat,long like this:
CLLocationCoordinate2D(latitude: -180.0, longitude: -180.0)
I am using following code for this:
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?)
{
let touchpoint = touches.first
if let touch = touches.first
{
var point: CGPoint = touch.locationInView(self.view)
let touchMapCoordinate: CLLocationCoordinate2D = MyMapView.projection.coordinateForPoint(point)
}
}
You can use following delegate method of
GMSMapView
.