DistanceFormatter
public class DistanceFormatter: LengthFormatter
Provides appropriately formatted, localized descriptions of linear distances.
-
Indicates the most recently used unit
Declaration
Swift
public private(set) var unit: LengthFormatter.Unit = .millimeter
-
Intializes a new
DistanceFormatter
.Declaration
Swift
@objc public init(approximate: Bool = false)
Parameters
approximate
approximates the distances.
-
Returns a more human readable
String
from a givenCLLocationDistance
.The user’s
Locale
is used here to set the units.Declaration
Swift
@objc public func string(from distance: CLLocationDistance) -> String