Common Enums 0.0.1
·
160 commits
to main
since this release
Notable changes
-
This version is the initial release! 🎉
-
An abstract
EnumFromValue
class was added that all enums' companion object with an internal representation should inherit. An example usage is as shown below:enum class Example(val value: String) { One("one"), Two("two"), Three("abc"); companion object : EnumFromValue<String, Example>(default = Three) { override fun fromValueOrNull(value: String) = when (value) { "one" -> One "two" -> Two "abc", "other value" -> Three else -> null } } }
Full Changelog: https://github.com/EdricChan03/androidx-ktx-extras/commits/common-enums@0.0.1
Usage
common-enums is published on Maven Central (as io.github.edricchan03.androidx.common:common-enums
) and can be included in your dependencies as shown below:
Kotlin/Groovy
build.gradle.kts
:
implementation("io.github.edricchan03.androidx.common:common-enums:0.0.1")
Version Catalogs
libs.versions.toml
:
[libraries]
androidxtra-common-enums = "io.github.edricchan03.androidx.common:common-enums:0.0.1"
build.gradle.kts
:
implementation(libs.androidxtra.common.enums)