title: Unable to remove previous polyline from last search
body: <p>I have a slight problem, I am unable to remove the previous polyline created from the previous search.</p>
  
  <p>I have looked at google documentation​ but i am unable to find the right answers.</p>
  
  <pre><code>let routes = json["routes"].arrayValue   
  for route in routes
          {
  
              let routeOverviewPolyline = route["overview_polyline"].dictionary
              print("routesOVER:",routeOverviewPolyline)
              let points = routeOverviewPolyline?["points"]?.stringValue
  
  
              let path = GMSPath.init(fromEncodedPath: points!)
  
  
              let polyline = GMSPolyline(path: path)
              if polyline != nil {
              print(polyline)
              polyline.strokeColor = .black
              polyline.strokeWidth = 10.0
              polyline.map = self.googleMaps
              }
  
          }
          }
          catch let error as NSError {
              print(error)
          }
  </code></pre>
  
  <p>in the google maps, 2 polylines are shown. 1 from the previous search and another from the current search</p>
  
  <p><a href="https://i.stack.imgur.com/cb3hd.png" rel="nofollow noreferrer">Google Maps Image</a></p>