MQRouteService

@interface MQRouteService : NSObject

An object that provides routes based on a starting point and set of locations, with options

  • Method to find out if there are any requests pending

    Declaration

    Objective-C

    - (BOOL)hasPendingRouteRequests;

    Swift

    func hasPendingRouteRequests() -> Bool

    Return Value

    YES if there are pending network requests

  • Attempts to get a route starting from first location to second location and then to third and so on using MQIDs This is the preferred method of requesting routes

    Declaration

    Objective-C

    - (void)
    requestRoutesWithStartLocation:(nonnull CLLocation *)startLocation
                      destinations:
                          (nonnull NSArray<id<MQRouteDestination>> *)destinations
                           options:(nonnull MQRouteOptions *)options
                        completion:
                            (nonnull MQRouteResponseCompletionBlock)completion;

    Swift

    func requestRoutes(withStart startLocation: CLLocation, destinations: [MQRouteDestination], options: MQRouteOptions, completion: @escaping MQRouteResponseCompletionBlock)

    Parameters

    startLocation

    Starting location for the route

    destinations

    List of MQRouteDestination-compliant objects that describe the list of locations

    options

    Route options for route

    completion

    Completion block to run when response is received from the API

  • Attempts to get a route starting from first location to second location and then to third and so on

    Declaration

    Objective-C

    - (void)requestRoutesWithStartLocation:(nonnull CLLocation *)startLocation
                      destinationLocations:
                          (nonnull NSArray<CLLocation *> *)destinationLocations
                                   options:(nonnull MQRouteOptions *)options
                                completion:(nonnull MQRouteResponseCompletionBlock)
                                               completion;

    Swift

    func requestRoutes(withStart startLocation: CLLocation, destinationLocations: [CLLocation], options: MQRouteOptions, completion: @escaping MQRouteResponseCompletionBlock)

    Parameters

    startLocation

    Starting location for the route

    destinationLocations

    List of locations for destinations

    options

    Route options for route

    completion

    Completion block to run when response is received from the API

  • Cancels any pending route requests

    Declaration

    Objective-C

    - (void)cancelRouteRequests;

    Swift

    func cancelRouteRequests()
  • Cancels any pending traffic/eta requests

    Declaration

    Objective-C

    - (void)cancelPendingTrafficRequests;

    Swift

    func cancelPendingTrafficRequests()
  • Cancels any pending route summary requests

    Declaration

    Objective-C

    - (void)cancelRouteSummaryRequests;

    Swift

    func cancelRouteSummaryRequests()
  • Attempts to get an optimized route summary including ETA, traffic conditions, and route length. This method uses the fastest route to the provided destination from a starting location.

    Use this as the fastest way to get ETAs of the destination provided.

    Declaration

    Objective-C

    - (void)
    requestRouteSummaryWithStartLocation:(nonnull CLLocation *)startLocation
                             destination:(nonnull id<MQRouteDestination>)destination
                              completion:(nonnull MQSummaryResponseCompletionBlock)
                                             completion;

    Swift

    func requestRouteSummary(withStart startLocation: CLLocation, destination: MQRouteDestination, completion: @escaping MQSummaryResponseCompletionBlock)

    Parameters

    startLocation

    Starting location for the route

    destination

    MQRouteDestination-compliant object that describes location

    completion

    Completion block to run when response is received from the API

  • Attempts to get an optimized route summary including ETA, traffic conditions, and route length. This method uses the fastest route to the provided destination from a starting location.

    Use this as the fastest way to get ETAs of the destination provided.

    Declaration

    Objective-C

    - (void)
    requestRouteSummaryWithStartLocation:(nonnull CLLocation *)startLocation
                             destination:(nonnull id<MQRouteDestination>)destination
                                 options:(nonnull MQBaseRouteOptions *)options
                              completion:(nonnull MQSummaryResponseCompletionBlock)
                                             completion;

    Swift

    func requestRouteSummary(withStart startLocation: CLLocation, destination: MQRouteDestination, options: MQBaseRouteOptions, completion: @escaping MQSummaryResponseCompletionBlock)

    Parameters

    startLocation

    Starting location for the route

    destination

    MQRouteDestination-compliant object that describes location

    options

    MQBaseRouteOptions let you choose between pedestrian and driving routing types

    completion

    Completion block to run when response is received from the API