Last active
March 4, 2026 07:45
-
-
Save benigumocom/af7eeb806d347c8d7f0d076cb7b918f0 to your computer and use it in GitHub Desktop.
Jetpack Compose Navigation3 - Destiination Nested 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 Home : AppDestination { | |
| override val label = "Home" | |
| override val iconRes = R.drawable.ic_home | |
| } | |
| @Serializable | |
| data object Settings : AppDestination { | |
| override val label = "Settings" | |
| override val iconRes = R.drawable.ic_settings | |
| } | |
| @Serializable | |
| data class Detail(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/