https://kotlinlang.org logo
#compose-android
Title
# compose-android
m

Mahmoud Ali Yousuf

10/30/2023, 4:14 PM
which one is better to use Sealed class or Enum for the navigation route?
z

Zach Klippenstein (he/him) [MOD]

10/30/2023, 4:30 PM
Depends if you want to add data to your routes
👍 1
E.g. with sealed class you can do stuff like
Copy code
sealed interface Screen
data class CustomerDetails(val customerId: String): Screen
i

Ian Lake

10/30/2023, 4:43 PM
Keep in mind that neither sealed classes or enums are going to be the right tool for the job once you move to multiple modules
z

Zach Klippenstein (he/him) [MOD]

10/30/2023, 4:46 PM
Depends how your modules and nav are organized. If your navigation is module-local, they can still work
m

Mahmoud Ali Yousuf

10/30/2023, 5:07 PM
@Ian Lake For now I'm now working in multi-module it's my personal app
@Zach Klippenstein (he/him) [MOD] Hmm, so sealed class is much more flexible and can provide more functionality, am I right?
👍🏻 1
j

Jonas

10/31/2023, 6:07 AM
TIL there are also sealed interfaces not only sealed classes. Makes sense 😅 Directly helps me with a small issue I had last week. gratitude thank you