CompassDirectionFormatter

public class CompassDirectionFormatter

The CompassDirectionFormatter class provides properly formatted descriptions of absolute compass directions. For example, a value of 90 may be formatted as “east”, depending on the locale.

  • Style is used to configure how a CompassDirectionFormatter translates a compass direction into a String.

    See more

    Declaration

    Swift

    public enum Style : Hashable
  • The Style used by this formatter. Defaults to Style.long.

    Declaration

    Swift

    public var style: CompassDirectionFormatter.Style
  • Creates a new CompassDirectionFormatter instance

    Declaration

    Swift

    public init()
  • Returns a localized string describing the provided compass direction.

    Declaration

    Swift

    public func string(from direction: CLLocationDirection) -> String

    Parameters

    direction

    A compass direction, measured in degrees, where 0° means “due north” and 90° means “due east”.

    Return Value

    A localized String describing the provided direction