show poly line direction

Hi everyone,


I have a little problem with my mapkit app.

I´m trying to show the route between 2 points with it respective coords, and it never show the polyline route


My code when I press show direction button:


//In the viewDidLoad
//...
let lat:CLLocationDegrees = Double(latitud)!
let long:CLLocationDegrees = Double(longitud)!
coordenadasEstacion = CLLocationCoordinate2D(latitude: lat, longitude: long)

@IBAction func dibujarRuta(_ sender: Any) {
     
        let ruta = MKDirectionsRequest()
        ruta.source = MKMapItem(placemark: MKPlacemark(coordinate: mapa.userLocation.coordinate))
        ruta.destination = MKMapItem(placemark: MKPlacemark(coordinate: coordenadasEstacion))
        ruta.requestsAlternateRoutes = false
        ruta.transportType = .any
     
        print ("ruta destino : ", ruta.destination as Any)
        print ("ruta origen : " , ruta.source as Any)

        let direcciones = MKDirections(request: ruta)
        direcciones.calculate(completionHandler:
            {
                response, error in guard let response = response
                    else
                {
                    if error != nil{print ("algo ha ido mal")
                    }
                    return
                }
                let route = response.routes[0]
                self.mapa.add(route.polyline, level: .aboveRoads)
             
                let rekt = route.polyline.boundingMapRect
                self.mapa.setRegion(MKCoordinateRegionForMapRect(rekt), animated: true)
        })
    }

    func mapView(_ mapa: MKMapView, didUpdate userLocation: MKUserLocation) {
        if !movedToUserLocation {
            mapa.region.center = mapa.userLocation.coordinate
            movedToUserLocation = true
        }
    }
  
    func mapView(_ mapa: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
        let lineaRuta = MKPolylineRenderer(overlay: overlay as! MKPolyline)
        lineaRuta.strokeColor = .blue
        lineaRuta.lineWidth = 5.0
        return lineaRuta
    }


It only show the 2 points, source and destination, but never the polyline


It will be a stupid thig but I´m offusqued with this problem


Can you help me, please??



Thank you so much mates.

show poly line direction
 
 
Q