AI-generated Key Takeaways
- 
          This guide explains how to set a vehicle's destination in the driver app after a trip is matched. 
- 
          You need to retrieve the destination waypoints from Fleet Engine's GetTrip(),UpdateTrip(), orGetVehicle()methods.
- 
          Use the Navigation SDK for iOS setDestinations()method to set the destination in the driver app, ensuring coordinates match the trip's waypoint for proper consumer app rendering.
This section documents how to set the vehicle's destination after your server matches a trip to a vehicle.
Before you begin
This section requires you to have completed the following:
Set the destination in the driver app
After you have paired a consumer with a driver, you must configure the trip's destination in the driver app by performing the following steps:
- Retrieve the vehicle's destination from its waypoints collection in Fleet Engine, which is returned by - GetTrip(),- UpdateTrip()and- GetVehicle().
- Set the destination by calling the Navigation SDK for iOS method - setDestinations().
The following examples show how to set the destination in the driver app.
Swift
private func startNavigation() {
  let destinations = [
    GMSNavigationWaypoint(
      placeID: "ChIJnUYTpNASkFQR_gSty5kyoUk", title: "PCC Natural Market"),
    GMSNavigationWaypoint(
      placeID: "ChIJJ326ROcSkFQRBfUzOL2DSbo", title: "Marina Park"),
  ]
  mapView.navigator?.setDestinations(destinations, callback: { routeStatus in
    guard routeStatus == .OK else {
      // Error starting navigation.
      return
    }
    mapView.locationSimulator?.simulateLocationsAlongExistingRoute()
    mapView.navigator?.isGuidanceActive = true
    mapView.navigator?.sendsBackgroundNotifications = true
    mapView.cameraMode = .following
  })
}
Objective-C
- (void)startNavigation {
  NSArray<GMSNavigationWaypoint *> *destinations =
  @[[[GMSNavigationWaypoint alloc] initWithPlaceID:@"ChIJnUYTpNASkFQR_gSty5kyoUk"
                                             title:@"PCC Natural Market"],
    [[GMSNavigationWaypoint alloc] initWithPlaceID:@"ChIJJ326ROcSkFQRBfUzOL2DSbo"
                                             title:@"Marina Park"]];
  [_mapView.navigator setDestinations:destinations
                             callback:^(GMSRouteStatus routeStatus) {
                               if (routeStatus != GMSRouteStatusOK) {
                                 // Error starting navigation.
                                 return;
                               }
                               [_mapView.locationSimulator simulateLocationsAlongExistingRoute];
                               _mapView.navigator.guidanceActive = YES;
                               _mapView.navigator.sendsBackgroundNotifications = YES;
                               _mapView.cameraMode = GMSNavigationCameraModeFollowing;
                             }];
}