Simple Kotlin Multiplatform library which supports different types of units of measure and
First, add a dependency to this library.
Gradle (Kotlin DSL)
// build.gradle.kts
dependencies {
implementation("io.github.john-tuesday:measure:$version")
// Optional, adds test fixtures
testImplementation("io.github.john-tuesday:measure-test:$version")
}
Now, use the library!
val quarterGrams: Mass = 5.67.grams
val quarterOz: Mass = 0.2.ounces
val twoQuarters = quarterGrams + quarterOz
- Energy
- Length
- Mass
- Volume
Generated api documentation can be found here, and notes on conventions can be found here.