title: Mapbox iOS SDK polyline, swift 3
body: <p>Mapbox SDK with swift 3.0 doesn't draw a polyline.</p>
  
  <p>(Swift 2.3 works fine)</p>
  
  <p>Swift 3 version:</p>
  
  <pre><code>for coord in coordsArray! {
  
                      let lat = coord.array?.first?.double
                      let lon = coord.array?.last?.double
  
                      let point = CLLocationCoordinate2D(latitude: lat!, longitude: lon!)
  
                      coordsArrayValues.append(point)
                  }
                  completionHandler(coordsArrayValues)
  </code></pre>
  
  <p>In completion handler method:</p>
  
  <pre><code>var rectangle: MGLPolyline?
  
      var coordsArrayValues = coordinatesArray
  
      // draw a route
  
      rectangle = MGLPolyline(coordinates: &amp;coordsArrayValues, count: UInt(coordsArrayValues.count))
  
      if let rectangle = rectangle {
          complection(rectangle)
      }
  </code></pre>
  
  <p>Here is what debugger says in about MGLPolyline and coordsArrayValues:
  (lldb) po coordsArrayValues
  ▿ 8 elements
    ▿ 0 : CLLocationCoordinate2D
      - latitude : 37.609333999999997
      - longitude : 55.750295000000001
    ▿ 1 : CLLocationCoordinate2D
      - latitude : 37.609400999999998
      - longitude : 55.750410000000002
    ▿ 2 : CLLocationCoordinate2D
      - latitude : 37.609442999999999
      - longitude : 55.750495000000001
    ▿ 3 : CLLocationCoordinate2D
      - latitude : 37.609763000000001
      - longitude : 55.751038999999999
    ▿ 4 : CLLocationCoordinate2D
      - latitude : 37.609966999999997
      - longitude : 55.751409000000002
    ▿ 5 : CLLocationCoordinate2D
      - latitude : 37.610123999999999
      - longitude : 55.751694000000001
    ▿ 6 : CLLocationCoordinate2D
      - latitude : 37.610168000000002
      - longitude : 55.751823999999999
    ▿ 7 : CLLocationCoordinate2D
      - latitude : 37.610219999999998
      - longitude : 55.751918000000003
  ,</p>
  
  <p>.</p>
  
  <p>Later on I call it:</p>
  
  <pre><code>self?.routeService.getRoute(coordinatesArray: coordinates, complection: { [weak self] polyline in
              self?.output.showRoute(polyline: polyline)
          })
  </code></pre>
  
  <p>In ViewController it is simply added as an annotation:</p>
  
  <pre><code>func showRoute(polyline: MGLPolyline) {
      DispatchQueue.main.async { [weak self] in
          self?.mapView.addAnnotation(polyline)
      }
  }
  </code></pre>