MGLDistanceFormatter

@interface MGLDistanceFormatter : NSLengthFormatter

MGLDistanceFormatter implements a formatter object meant to be used for geographic distances. The user’s current locale will be used by default but it can be overriden by changing the locale property of the numberFormatter.

-stringFromDistance:

Returns a localized formatted string for the provided distance.

Declaration

Objective-C

- (nonnull NSString *)stringFromDistance:(CLLocationDistance)distance;

Swift

func string(fromDistance distance: CLLocationDistance) -> String

Parameters

distance

The distance, measured in meters.

Return Value

A localized formatted distance string including units.

iOS SDK

SDK JS Reference

On this page