Last active
March 4, 2026 07:46
-
-
Save benigumocom/22d6bfd3d3498537e6c96459fe393bd1 to your computer and use it in GitHub Desktop.
Jetpack Compose Navigation3 - Destiination sealed interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Serializable | |
| sealed interface AppDestination { | |
| val label: String | |
| @get:DrawableRes val iconRes: Int | |
| } | |
| @Serializable | |
| data object HomeDestination : AppDestination { | |
| override val label = "Home"; override val iconRes = R.drawable.ic_home | |
| } | |
| @Serializable | |
| data class DetailDestination(val id: String) : AppDestination { | |
| override val label = "Detail"; override val iconRes = R.drawable.ic_detail | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Navigation3 時代の Destination 設計:sealed interface による型安全な実装パターンと使い分け
https://android.benigumo.com/20260304/navigation3-sealed-interface/