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:

- [Initialize the Driver SDK](https://developers.google.com/maps/documentation/mobility/driver-sdk/on-demand/ios/initialize-sdk.md.txt)
- [Get the vehicle ready](https://developers.google.com/maps/documentation/mobility/driver-sdk/on-demand/ios/vehicle-ready.md.txt)
- [Create a trip in Fleet Engine](https://developers.google.com/maps/documentation/mobility/fleet-engine/journeys/trips/create-trip.md.txt)

## 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:

1. Retrieve the vehicle's destination from its waypoints collection in Fleet
   Engine, which is returned by `GetTrip()`, `UpdateTrip()` and `GetVehicle()`.

2. Set the destination by calling the Navigation SDK for iOS method
   [`setDestinations()`](https://developers.google.com/maps/documentation/navigation-sdk-ios/reference/interface_g_m_s_navigator#ae62d9db4071a0df6c3651b9675356df8).

   > [!NOTE]
   > **Note:** For the consumer app to properly render the trip, make sure the geographic latitude/longitude coordinates supplied to `setDestinations()` match those in the trip's waypoint. For more information, see the tutorial [Navigate a route](https://developers.google.com/maps/documentation/navigation/ios-sdk/route.md.txt).

The following examples show how to set the destination in the driver
app.

### Swift

```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

```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;
                             }];
}
```