-
-
Save laevandus/d2f4b50e6ccf6b703baed749356bccde 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
class UnitBanana: Dimension { | |
override static func baseUnit() -> Self { | |
return UnitBanana.banana as! Self | |
} | |
static let banana = UnitBanana(symbol: "bana", converter: UnitConverterLinear(coefficient: 1.0)) | |
} | |
let formatter = MeasurementFormatter() | |
formatter.unitOptions = .providedUnit | |
print(formatter.string(from: Measurement(value: 2, unit: UnitBanana.banana))) | |
// 2 bana |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment