zt
05/19/2023, 1:35 AM@Parcelize
enum class BaseDestination(
@IgnoredOnParcel
val icon: ImageVector,
@IgnoredOnParcel
@StringRes
val label: Int
) : AppDestination {
HOME(Icons.Default.Home, R.string.home),
FEED(Icons.Default.Subscriptions, R.string.feed),
LIBRARY(Icons.Default.VideoLibrary, R.string.library)
}
I'm trying to make it so that it doesnt include the icon and label in parcelization, since those are never gonna change and are not required to be stored. However it says I cannot use IgnoredOnParcel without a default value. What am I supposed to do?ephemient
05/19/2023, 1:52 AMzt
05/19/2023, 1:53 AMephemient
05/19/2023, 1:56 AMBundle.readParcelable<BaseDestination>()
returns...?ephemient
05/19/2023, 1:57 AMephemient
05/19/2023, 1:59 AMTuna
05/19/2023, 2:42 AMTuna
05/19/2023, 2:43 AMephemient
05/19/2023, 3:28 AMwriteString(enum.name())
and Enum.valueOf(readString())
, not ordinal and not through Serializable: https://github.com/JetBrains/kotlin/blob/master/plugins/parcelize/parcelize-compiler/parcelize.backend/src/org/jetbrains/kotlin/parcelize/IrParcelSerializers.kt#L154-L176ephemient
05/19/2023, 3:32 AMzt
05/19/2023, 6:10 AMephemient
05/19/2023, 6:25 AM