MGLCoordinateFormatter

@interface MGLCoordinateFormatter : NSFormatter

The MGLCoordinateFormatter class provides properly formatted descriptions of geographic coordinate pairs. Use this class to create localized coordinate strings when displaying location information to users.

allowsMinutes

Determines whether the output may contain minutes of arc when nonzero.

The default value of this property is YES, causing the receiver to include minutes of arc in its output. If allowsSeconds is YES, this property is ignored and the output always includes minutes of arc.

Declaration

Objective-C

@property (nonatomic, assign, unsafe_unretained, readwrite) BOOL allowsMinutes;

Swift

var allowsMinutes: Bool { get set }

allowsSeconds

Determines whether the output may contain seconds of arc when nonzero.

The default value of this property is YES, causing the receiver to include seconds of arc in its output.

Declaration

Objective-C

@property (nonatomic, assign, unsafe_unretained, readwrite) BOOL allowsSeconds;

Swift

var allowsSeconds: Bool { get set }

unitStyle

The unit style used by this formatter.

The default value of this property is NSFormattingUnitStyleMedium.

Declaration

Objective-C

@property (nonatomic, assign, unsafe_unretained, readwrite)
NSFormattingUnitStyle unitStyle;

Swift

var unitStyle: Formatter.UnitStyle { get set }

-stringFromCoordinate:

Returns a coordinate string for the provided value.

Declaration

Objective-C

- (nonnull NSString *)stringFromCoordinate:(CLLocationCoordinate2D)coordinate;

Swift

func string(from coordinate: CLLocationCoordinate2D) -> String

Parameters

coordinate

The coordinate’s value.

Return Value

The coordinate string appropriately formatted for the formatter’s locale.

-getObjectValue:forString:errorDescription:

This method is not supported for the MGLCoordinateFormatter class.

Declaration

Objective-C

- (BOOL)getObjectValue:(out id _Nullable *_Nullable)obj
         forString:(nonnull NSString *)string
  errorDescription:(out NSString *_Nullable *_Nullable)error;

Swift

func getObjectValue(_ obj: AutoreleasingUnsafeMutablePointer<AnyObject?>?, for string: String, errorDescription error: AutoreleasingUnsafeMutablePointer<NSString?>?) -> Bool
iOS SDK

SDK JS Reference

On this page