Skip to content

Instantly share code, notes, and snippets.

@vialyx
Created March 21, 2018 19:39
Show Gist options
  • Save vialyx/9274fbc524ec705577eb6f4554f6439e to your computer and use it in GitHub Desktop.
Save vialyx/9274fbc524ec705577eb6f4554f6439e to your computer and use it in GitHub Desktop.
let unit = Measurement(value: 1290, unit: UnitLength.miles)
let measurementFormatter = MeasurementFormatter()
print("Measurement miles: \(measurementFormatter.string(from: unit))")
// Measurement miles: 1,290 mi
let kilometers = unit.converted(to: UnitLength.kilometers)
// 2076.0486 km
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment