title: iOS Swift Getting directions between two points and drawing to map
body: <p>I want to get the directions between two points and draw them to my MKMapView. This is my implementation:</p>
  
  <p>First, at my controller's viewDidLoad callback, I set map's view delegate to self</p>
  
  <pre><code>map.delegate = self
  </code></pre>
  
  <p>Then, I request all routes:</p>
  
  <pre><code>func showDirections() {
          let currentPlace: MKPlacemark = MKPlacemark(coordinate: location.coordinate, addressDictionary: nil)
          let place: MKPlacemark = MKPlacemark(coordinate: annotation.coordinate, addressDictionary: nil)
  
  
  
      println(currentPlace.coordinate.latitude)
      println(currentPlace.coordinate.longitude)
      println(place.coordinate.latitude)
      println(place.coordinate.longitude)
  
      var request: MKDirectionsRequest = MKDirectionsRequest.new()
      request.setSource(MKMapItem(placemark: currentPlace))
      request.setDestination(MKMapItem(placemark: place))
      request.transportType = MKDirectionsTransportType.Any
      request.requestsAlternateRoutes = true
      var directions: MKDirections = MKDirections(request: request)
      directions.calculateDirectionsWithCompletionHandler() {
          (response, error) in
          println(error)
          if(error == nil &amp;&amp; response != nil) {
              println("Numero de rutas: " + String(response.routes.count))
              println(response.routes[0].coordinate)
              for(var i = 0;i &lt; response.routes.count; i++) {
                  self.map.addOverlays(response.routes[i].overlays, level: MKOverlayLevel.AboveRoads)
                  self.map.setNeedsDisplay()
              }
              for r in response.routes { println("route = \(r)") }
          }
      }
  
  }
  </code></pre>
  
  <p>And implement this two callbacks too:</p>
  
  <pre><code>func mapView(mapView: MKMapView!, rendererForOverlay overlay: MKOverlay!) -&gt; MKOverlayRenderer! {
          println("redenrerForOverlay")
          if(overlay.isKindOfClass(MKPolyline)) {
              var renderer: MKPolylineRenderer = MKPolylineRenderer(overlay: overlay)
              renderer.strokeColor = Colors.psnGreen
              renderer.lineWidth = 5
              return renderer
          }
          return nil
      }
  
  func mapView(mapView: MKMapView!, viewForOverlay overlay: MKOverlay!) -&gt; MKOverlayView! {
          println("ViewForOverlay")
          if (overlay.isKindOfClass(MKPolyline)) {
              var lineView: MKPolylineView = MKPolylineView(overlay: overlay)
              lineView.backgroundColor = Colors.psnGreen
  
              return lineView;
          }
          return nil;
      }
  </code></pre>
  
  <p>When i run my application, I get two routes to draw, but when I call map.addOverlay, nothing happens. My rendererForOverlay/viewForOverlay are never called. Somenone know how to make it work?</p>
  
  <p>Thanks in advance</p>