How to format distance in iOS

Issue #307

1
2
3
4
5
6
import MapKit

let formatter = MKDistanceFormatter()
formatter.unitStyle = .abbreviated
formatter.units = .metric
distanceLabel.text = formatter.string(fromDistance: distance) // 700m, 1.7km

Comments