SPRoute
Objective-C
@interface SPRoute : NSObject <NSCopying>
Swift
class 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
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.
-
Return Value
starting location for the route
-
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