Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created January 17, 2021 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/6b70f72775ce0195622f707a8f1405b2 to your computer and use it in GitHub Desktop.
Save laevandus/6b70f72775ce0195622f707a8f1405b2 to your computer and use it in GitHub Desktop.
let formatter = MeasurementFormatter()
formatter.locale = Locale(identifier: "en_US")
print(formatter.string(from: Measurement(value: 293, unit: UnitTemperature.kelvin)))
// 67.73°F
formatter.locale = Locale(identifier: "en_GB")
print(formatter.string(from: Measurement(value: 293, unit: UnitTemperature.kelvin)))
// 19.85°C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment