Waypoints List UI

Display a list of waypoints for the navigation route.

Before you can do this, you need a TGRoute . Here's how to get one.

func showWaypointsList(route: TGRoute) {
    let viewController = TGWaypointsListViewController.create()
    viewController.route = route
    
    viewController.nextWaypoint = route.segments.first!.destinationWaypoint
    viewController.getCurrentLocationWaypoint = { () -> TGWaypoint in
        return route.segments.first!.originWaypoint
    }
    
    if let navigationController = navigationController {
        navigationController.navigationBar.isHidden = false
        navigationController.pushViewController(viewController, animated: true)
        
    } else {
        viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(pressDoneButton(_:)))
        present(viewController.embedInNavigationController(), animated: true, completion: nil)
    }
}

// This method isn't necessary if you're pushing it onto a UINavigationController
@objc func pressDoneButton(_ sender: UIBarButtonItem) {
    dismiss(animated: true, completion: nil)
}
- (void)showWaypointsList:(TGRoute *)route {
    TGWaypointsListViewController *viewController = [TGWaypointsListViewController create];
    viewController.route = route;
    
    viewController.nextWaypoint = route.segments.firstObject.destinationWaypoint;
    viewController.getCurrentLocationWaypoint = ^TGWaypoint * _Nonnull{
        return route.segments.firstObject.originWaypoint;
    };
    
    if (self.navigationController != nil) {
        self.navigationController.navigationBar.hidden = NO;
        [self.navigationController pushViewController:viewController animated:YES];
        
    } else {
        viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem.alloc initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(pressDoneButton:)];
        [self presentViewController:[viewController embedInNavigationController] animated:YES completion:nil];
    }
}

// This method isn't necessary if you're pushing it onto a UINavigationController
- (void)pressDoneButton:(UIBarButtonItem *)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}
Check out the iOS Reference App to see this example in action.

Look for example 210 in the app.