When I try to annotate an enum class
or object
with @Parcelize
, it results in the error 'Parcelable' should be a class
, both as an editor hint and as a compile failure. I can @Parcelize
classes just fine, but I can't do things like
@Parcelize object MySingletion : Parcelable
@Parcelize enum class Direction : Parcelable { N, E, W, S }
This happens even though the Kotlin website explicitly states that objects and enums are supported. Is there a way to fix this so that I can @Parcelize
these types of classes? And ideally, is there a solution that doesn't involve manually coding the parceler logic?
Since Kotlin 1.2.60, the CHANGELOG states that Parcelize works with object and enum types.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With