https://kotlinlang.org logo
#getting-started
Title
# getting-started
i

ildar.i [Android]

10/12/2020, 1:35 PM
How can I parse sealed class from string? With enum I can iterate over its values and find it, but can I do the same with sealed class?
d

diesieben07

10/12/2020, 1:37 PM
You can use KClass#sealedSubclasses, but it requires the full Kotlin reflection library
👍 1
v

Vaios Tsitsonis

10/12/2020, 1:42 PM
If you use moshi you could use this extensions https://github.com/ZacSweers/MoshiX/tree/main/moshi-sealed
👍 1
i

ildar.i [Android]

10/12/2020, 1:46 PM
Thanks! I will dig into it
🙂 1
a

arekolek

10/12/2020, 1:58 PM
3 Views