diff --git a/library/build.gradle b/library/build.gradle index 28915c7..663a1ac 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -9,7 +9,7 @@ android { minSdkVersion 15 targetSdkVersion 28 versionCode 2 - versionName "1.0-alpha04" + versionName "1.0-alpha05" } buildTypes { diff --git a/library/src/main/java/com/perculacreative/ktx/Enum.kt b/library/src/main/java/com/perculacreative/ktx/Enum.kt new file mode 100644 index 0000000..7835db7 --- /dev/null +++ b/library/src/main/java/com/perculacreative/ktx/Enum.kt @@ -0,0 +1,9 @@ +package com.perculacreative.ktx + +inline fun > Enum.safeValueOf(name: String): T? { + return try { + enumValueOf(name) + } catch (e: IllegalArgumentException) { + null + } +}