RadarRouteDistance represents the distance of a route, including both the numeric value and a formatted display string.
Properties
The distance in feet (for imperial units) or meters (for metric units).
A display string for the distance. This is a human-readable formatted string appropriate for the unit system (e.g., “1.2 mi” or “2.0 km”).
Instance Methods
dictionaryValue
func dictionaryValue() -> [String: Any]
- (NSDictionary *_Nonnull)dictionaryValue;
Converts the route distance to a dictionary representation.
Returns
A dictionary representation of the route distance.
Example
// Get routing information
Radar.getDistance(
origin: origin,
destination: destination,
modes: [.car],
units: .imperial
) { (status, routes) in
if let distance = routes?.car?.distance {
print("Distance: \(distance.text)")
print("Distance in feet: \(distance.value)")
}
}
// Get routing information
[Radar getDistanceFromOrigin:origin
destination:destination
modes:RadarRouteModeCar
units:RadarRouteUnitsImperial
completionHandler:^(RadarStatus status, RadarRoutes * _Nullable routes) {
RadarRouteDistance *distance = routes.car.distance;
if (distance) {
NSLog(@"Distance: %@", distance.text);
NSLog(@"Distance in feet: %f", distance.value);
}
}];
See Also