0

How to remove only the polylines from my GMSMapView in Swift.

I don't use map.clear() because I have like 100 markers and groundOverlays that I don't want to delete and I do not have references of them.

Pablo Marrufo
  • 855
  • 1
  • 8
  • 17
  • Possible duplicate of [Remove GMSPolyline from GMSMapView](https://stackoverflow.com/questions/25102778/remove-gmspolyline-from-gmsmapview) – Tamás Sengel Apr 17 '18 at 21:32
  • @the4kman it is not a duplicate, because that question is of Objective-C code and do not have an accepted answer. Also I edited my question to show the difference of my question. Because y do not have reference of the polylines. – Pablo Marrufo Apr 18 '18 at 16:55

1 Answers1

1

Keep a record of the Polyline Array and set the .map property to nil for each polyline you want to remove.

let poly = GSMPolyline()

poly.map = mapView to show

poly.map = nil to remove
Mark
  • 515
  • 2
  • 4
  • 8