Skip to main content
RadarRoutes represents routes from an origin to a destination across different travel modes, including foot, bike, car, truck, and motorbike.

Properties

geodesic
RadarRouteDistance
The geodesic distance between the origin and destination. This is the shortest distance between two points on the surface of a sphere (straight-line distance).
foot
RadarRoute
The route by foot between the origin and destination. May be nil if mode not specified or route unavailable.
bike
RadarRoute
The route by bike between the origin and destination. May be nil if mode not specified or route unavailable.
car
RadarRoute
The route by car between the origin and destination. May be nil if mode not specified or route unavailable.
truck
RadarRoute
The route by truck between the origin and destination. May be nil if mode not specified or route unavailable.
motorbike
RadarRoute
The route by motorbike between the origin and destination. May be nil if mode not specified or route unavailable.

Instance Methods

dictionaryValue

func dictionaryValue() -> [String: Any]
- (NSDictionary *_Nonnull)dictionaryValue;
Converts the routes to a dictionary representation.

Returns

A dictionary representation of the routes.

Example

// Get routing information for multiple modes
Radar.getDistance(
    origin: origin,
    destination: destination,
    modes: [.car, .bike, .foot],
    units: .imperial
) { (status, routes) in
    if let routes = routes {
        // Check geodesic distance
        if let geodesic = routes.geodesic {
            print("Straight-line distance: \(geodesic.text)")
        }
        
        // Check car route
        if let car = routes.car {
            print("Car: \(car.distance.text), \(car.duration.text)")
        }
        
        // Check bike route
        if let bike = routes.bike {
            print("Bike: \(bike.distance.text), \(bike.duration.text)")
        }
        
        // Check walking route
        if let foot = routes.foot {
            print("Walking: \(foot.distance.text), \(foot.duration.text)")
        }
    }
}
// Get routing information for multiple modes
[Radar getDistanceFromOrigin:origin
                  destination:destination
                        modes:RadarRouteModeCar | RadarRouteModeBike | RadarRouteModeFoot
                        units:RadarRouteUnitsImperial
            completionHandler:^(RadarStatus status, RadarRoutes * _Nullable routes) {
    if (routes) {
        // Check geodesic distance
        if (routes.geodesic) {
            NSLog(@"Straight-line distance: %@", routes.geodesic.text);
        }
        
        // Check car route
        if (routes.car) {
            NSLog(@"Car: %@, %@", routes.car.distance.text, routes.car.duration.text);
        }
        
        // Check bike route
        if (routes.bike) {
            NSLog(@"Bike: %@, %@", routes.bike.distance.text, routes.bike.duration.text);
        }
        
        // Check walking route
        if (routes.foot) {
            NSLog(@"Walking: %@, %@", routes.foot.distance.text, routes.foot.duration.text);
        }
    }
}];

See Also

Build docs developers (and LLMs) love