I want to change the marker icon and show info window when tapped on the marker. My question here is how to change the marker icon?
I have stored the google maps instance and tried updating it my setting iconView property of that marker
func setUpMarker() {
let markerView = UIImageView(image: UIImage(named: "pinImage"))
let marker = GMSMarker()
marker.position = CLLocationCoordinate2D(latitude: lat, longitude: lng)
marker.iconView = markerView
storeMarker = marker
}
Method to update marker
func updateMarker() {
let markerView = UIImageView(image: UIImage(named: "circleImage"))
storeMarker.iconView = markerView
}
But, this adds a new icon on the previous icon.