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.

  • 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 (assign, readwrite, nonatomic) BOOL allowsMinutes;

    Swift

    var allowsMinutes: Bool { get set }
  • 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 (assign, readwrite, nonatomic) BOOL allowsSeconds;

    Swift

    var allowsSeconds: Bool { get set }
  • The unit style used by this formatter.

    The default value of this property is NSFormattingUnitStyleMedium.

    Declaration

    Objective-C

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

    Swift

    var unitStyle: Formatter.UnitStyle { get set }
  • 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.

  • 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