<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.2.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MapKit",
  "identifier" : "/documentation/MapKit/MKDistanceFormatter",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "MapKit"
    ],
    "preciseIdentifier" : "c:objc(cs)MKDistanceFormatter"
  },
  "title" : "MKDistanceFormatter"
}
-->

# MKDistanceFormatter

A utility object that converts between a geographic distance and a string-based expression of that distance.

```
class MKDistanceFormatter
```

## Overview

Use a distance formatter to display distances to the user or to parse user-specified text to obtain a numerical value for a distance. When formatting strings containing distances, a distance formatter object takes into account the user’s locale and language settings. You can also specify a custom locale or custom units for any distances that you format.

## Topics

### Converting distances

[`-  stringFromDistance:`](/documentation/MapKit/MKDistanceFormatter/string(fromDistance:))

Creates a string representation of the specified distance.

[`-  distanceFromString:`](/documentation/MapKit/MKDistanceFormatter/distance(from:))

Returns the distance value parsed from the specified string.

### Specifying the format

[`locale`](/documentation/MapKit/MKDistanceFormatter/locale)

The locale to use when formatting strings.

[`units`](/documentation/MapKit/MKDistanceFormatter/units-swift.property)

The measuring system — imperial or metric — to use for units.

[`Units`](/documentation/MapKit/MKDistanceFormatter/Units-swift.enum)

Constants that reflect the type of units to use in the string.

[`unitStyle`](/documentation/MapKit/MKDistanceFormatter/unitStyle)

The preferred style for units.

[`DistanceUnitStyle`](/documentation/MapKit/MKDistanceFormatter/DistanceUnitStyle)

Constants that indicate the format style to use for strings.

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`CVarArg`](/documentation/Swift/CVarArg)

### Inherits From

[`Formatter`](/documentation/Foundation/Formatter)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)