I have draw the polylines, but I don't no that what coding can remove the tracked polyline in the google map. I'm trying some coding in below.
this is no working.
var polyline = GMSPolyline()
polyline.map = nil
this is working to remove tracked polyline, but when I'm maked the markers and tap it, marker can not sow the info window.
mapView.clear()
Thank you
Solution:
Sample Coding:
//Step 1:
var mapView = GMSMapView()
let path = GMSMutablePath()
path.add(CLLocationCoordinate2D(latitude: 37.36, longitude: -122.0))
path.add(CLLocationCoordinate2D(latitude: 37.45, longitude: -122.0))
path.add(CLLocationCoordinate2D(latitude: 37.45, longitude: -122.2))
path.add(CLLocationCoordinate2D(latitude: 37.36, longitude: -122.2))
path.add(CLLocationCoordinate2D(latitude: 37.36, longitude: -122.0))
let rectangle = GMSPolyline(path: path)
//Step 2:
var oldPolylineArr = [GMSPolyline]()
Array
//Step 3:
oldPolyline.append(rectangle)
//Step 4:
for p in (0 ..< oldPolylineArr.count) {
oldPolylineArr[p].map = nil
}
is NOT Array
//Step 3:
oldPolyline = polyline
//Step 4:
oldPolyline.map = nil