-
-
Save laevandus/fe76115346fd5c7aafca0a9f55c0be31 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let formatter = MeasurementFormatter() | |
let unitStyles: [Formatter.UnitStyle] = [.short, .medium, .long] | |
for unitStyle in unitStyles { | |
formatter.unitStyle = unitStyle | |
let measurement = Measurement(value: 9.8, unit: UnitAcceleration.gravity) | |
print(formatter.string(from: measurement)) | |
} | |
// Prints: | |
// 9.8Gs | |
// 9.8 G | |
// 9.8 g-force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment