DistanceFormatter

public class DistanceFormatter: LengthFormatter

Provides appropriately formatted, localized descriptions of linear distances.

  • Intializes a new DistanceFormatter.

    Declaration

    Swift

    public init(approximate: Bool = false, forVoiceUse: Bool = false)

    Parameters

    approximate

    approximates the distances.

    forVoiceUse

    If true, the returned string will contain strings for some numbers like fractions. This is helpful for some speech synthesizers.

  • Returns a more human readable String from a given CLLocationDistance.

    The user’s Locale is used here to set the units.

    Declaration

    Swift

    public func string(from distance: CLLocationDistance) -> String