# MGLClockDirectionFormatter

    @interface MGLClockDirectionFormatter : NSFormatter

The `MGLClockDirectionFormatter` class provides properly formatted descriptions of headings relative to the user, known as clock positions. For example, a value of `90` may be formatted as “3 o’clock”, depending on the locale.

Use this class to create localized heading strings when displaying directions relative to the user’s current location and heading. To format a direction irrespective of the user’s orientation, use `MGLCompassDirectionFormatter` instead.

- `unitStyle`

  The unit style used by this formatter.

  This property defaults to `NSFormattingUnitStyleMedium`.

  #### Declaration

  Objective-C

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

  Swift

      var unitStyle: Formatter.UnitStyle { get set }

  View Source on GitHub
- `-stringFromDirection:`

  Returns a clock position string for the provided value.

  #### Declaration

  Objective-C

      - (nonnull NSString *)stringFromDirection:(CLLocationDirection)direction;

  Swift

      func string(fromDirection direction: CLLocationDirection) -> String

  #### Parameters

  `direction` | The heading, measured in degrees, where 0° means “straight ahead” and 90° means “directly to your right”.

  #### Return Value

  The clock position string appropriately formatted for the receiver’s locale.

  View Source on GitHub
- `-getObjectValue:forString:errorDescription:`

  This method is not supported for the `MGLDirectionFormatter` 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

  View Source on GitHub