Итак, мне удалось найти пример приложения, а также ошибку.
Ниже приведен код из примера приложения, который выдает ошибку как
Значение типа «Маршрут» имеет нет члена 'координирует' @routes? .first? .coordinates
Directions.shared.calculate(routeOptions) { (waypoints, routes, error) in
guard let routeCoordinates = routes?.first?.coordinates, error == nil else {
print(error!.localizedDescription)
return
}
//
// ❗️IMPORTANT❗️
// Use `Directions.calculateRoutes(matching:completionHandler:)` for navigating on a map matching response.
//
let matchOptions = NavigationMatchOptions(coordinates: routeCoordinates)
// By default, each waypoint separates two legs, so the user stops at each waypoint.
// We want the user to navigate from the first coordinate to the last coordinate without any stops in between.
// You can specify more intermediate waypoints here if you’d like.
for waypoint in matchOptions.waypoints.dropFirst().dropLast() {
waypoint.separatesLegs = false
}
Directions.shared.calculateRoutes(matching: matchOptions) { (waypoints, routes, error) in
guard let route = routes?.first, error == nil else { return }
// Set the route
self.navigationViewController?.route = route
}
}
, который должен быть переписан, как показано ниже.
Directions.shared.calculate(routeOptions) { (waypoints, routes, error) in
guard let firstRoute = routes?.first, let waypoints = waypoints, error == nil else {
print(error!.localizedDescription)
return
}
//
// ❗️IMPORTANT❗️
// Use `Directions.calculateRoutes(matching:completionHandler:)` for navigating on a map matching response.
//
let matchOptions = NavigationMatchOptions(waypoints: waypoints)
// By default, each waypoint separates two legs, so the user stops at each waypoint.
// We want the user to navigate from the first coordinate to the last coordinate without any stops in between.
// You can specify more intermediate waypoints here if you’d like.
for waypoint in matchOptions.waypoints.dropFirst().dropLast() {
waypoint.separatesLegs = false
}
Directions.shared.calculateRoutes(matching: matchOptions) { (waypoints, routes, error) in
guard let route = routes?.first, error == nil else { return }
// Set the route
self.navigationViewController?.route = route
}
}
Пожалуйста, проверьте, решает ли это вашу проблему