SPRoute

@interface SPRoute : NSObject <NSCopying>

Defines a route between two coordinates.

  • Recommended constructor for SPRoute objects

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDestination:(nonnull SPLocation *)destination
                                          steps:(nonnull NSArray<SPRouteStep *> *)
                                                    steps;

    Swift

    init(destination: SPLocation, steps: [SPRouteStep])

    Parameters

    destination

    final destination at the end of the route

    steps

    list of route steps

  • Get a list of steps for the route

    Declaration

    Objective-C

    - (nonnull NSArray<SPRouteStep *> *)steps;

    Swift

    func steps() -> [SPRouteStep]

    Return Value

    list containing each step on the route

  • Get the last location on the route aka. the destination

    Declaration

    Objective-C

    - (nonnull SPLocation *)destination;

    Swift

    func destination() -> SPLocation

    Return Value

    destination for route

  • Get the full list of coordinates for the entire route.

    Declaration

    Objective-C

    - (nonnull NSArray<NSArray<NSNumber *> *> *)coordinates;

    Swift

    func coordinates() -> [[NSNumber]]

    Return Value

    list of coordinates in format: [ [lat, lon, floor], …]

  • Declaration

    Objective-C

    - (CGFloat)distance;

    Swift

    func distance() -> CGFloat

    Return Value

    distance of the whole route in meters.

  • Declaration

    Objective-C

    - (CGFloat)duration;

    Swift

    func duration() -> CGFloat

    Return Value

    duration of the whole route in seconds.

  • Declaration

    Objective-C

    - (nonnull SPLocation *)start;

    Swift

    func start() -> SPLocation

    Return Value

    starting location for the route

  • Declaration

    Objective-C

    - (nonnull SPLocation *)end;

    Swift

    func end() -> SPLocation

    Return Value

    end location for the route

  • Appends another route to the end of this route

    Declaration

    Objective-C

    - (void)append:(nonnull SPRoute *)route;

    Swift

    func append(_ route: SPRoute)

    Parameters

    route

    another route