isaac-udy / Enro

A simple navigation library for Android 🗺️
https://enro.dev
Apache License 2.0
255 stars 13 forks source link

Support for Kotlin and Compose Multiplatform #195

Open xxfast opened 1 month ago

xxfast commented 1 month ago

Hi @isaac-udy Great work on Enro

I'm curious to know what are the specific blockers to fully migrate this to Kotlin Multiplatform to allow us to use Enro with Compose Multiplatform.

isaac-udy commented 1 month ago

Converting Enro to use Kotlin Multiplatform has been on my to-do list for a while. Most of the work that needs to be done is simply pulling the Android-specific parts (the Activity/Fragment support) out so they can be provided back as plugins. I've been slowly working on this as I add other features/functionality, but there's still more to do here.

The other major change that needs to be explored is the use of Parcelable as a super-type of NavigationKey, for use in Saved State/Bundles. This is slightly trickier than moving around the Android-specific parts, because there's no exact clear path forward. We could follow AndroidX Navigation and use @Serializable instead. I don't love this idea, as it doesn't come with a type/interface attached (e.g. no compile time safety that a type is serializable with Kotlin Serialization). There's also some work going on with making AndroidX's SavedState module multiplatform compatible, but this is still in alpha (and I'm not entirely sure this will actually solve the problem that we're looking to solve).

I'd love to hear any suggestions regarding what to do with the NavigationKey super-type/moving away from Parcelable.