title: Swift, MKPolyline how to create polyline between coordinate point
body: <p>Hi I wrote this code to draw a polyline between some point:</p>
  
  <pre><code>var arrayToDraw: Array&lt;Any&gt; = []
  var forpolyline: Array&lt;CLLocationDegrees&gt; = []
  var forpolyline2: CLLocationCoordinate2D = CLLocationCoordinate2D.init()
  
  
  func showRoute() {
      for h in 0...(orderFinalDictionary.count - 1){
          arrayToDraw = orderFinalDictionary[h].value
          print(arrayToDraw)
          var arrayToDrawCount = arrayToDraw.count
          for n in 0...(arrayToDrawCount - 1){
              forpolyline = (arrayToDraw[n] as! Array&lt;CLLocationDegrees&gt;)
              forpolyline2.latitude = (forpolyline[0])
              forpolyline2.longitude = (forpolyline[1])
              print(forpolyline2)
                  var geodesic = MKPolyline(coordinates: &amp;forpolyline2, count: 1)
                  self.mapView.add(geodesic)
          }
      }
  }
  
  func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -&gt; MKOverlayRenderer {
      let renderer = MKPolylineRenderer(polyline: overlay as! MKPolyline)
      renderer.strokeColor = UIColor.red
      renderer.lineWidth = 3
  
      return renderer
  }
  </code></pre>
  
  <p>It takes coordinates from a Dictionary, put it in a array(arraToDraw) and I use forpolyline and forpolyline2 to cast values.</p>
  
  <p>Now the problem is that it only draw dots on the coordinates how can I connect that?</p>