title: How do i animate GMSPolyline in google maps ios
body: <p>I was using google maps SDK and I have to draw polyline when user moves, currently it just animates the marker only, path drawn before pin moves to specific location. I have to draw path and move pin at same time.</p>
  
  <p>Check this video : <a href="https://www.dropbox.com/s/q5kdjf4iq0337vg/Map_Sample.mov?dl=0" rel="noreferrer">https://www.dropbox.com/s/q5kdjf4iq0337vg/Map_Sample.mov?dl=0</a></p>
  
  <p>Here is my code</p>
  
  <pre><code>func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
          let location = locations.last!
          userPath.addCoordinate(location.coordinate) //userPath -&gt; GMSMutablePath
          let polyline = GMSPolyline(path: userPath)
          polyline.strokeColor = UIColor(red: 0, green: 191/255.0, blue: 1, alpha: 0.8)
          polyline.strokeWidth = 5
          CATransaction.begin()
          CATransaction.setAnimationDuration(2.0)
          self.userMarker.position = location.coordinate
          self.userMarker.rotation = location.course
          polyline.map = self.googleMapView
          CATransaction.commit()
      }
  </code></pre>
  
  <p>Also here is the screenshot how it works now
  <a href="https://i.stack.imgur.com/QDI9s.png" rel="noreferrer"><img src="https://i.stack.imgur.com/QDI9s.png" alt="Sample Image"></a></p>