Morning everyone 👋
I have a question regarding re-usable composables across Android feature modules.
Let’s say we have a
featureA:api
,
featureA:impl
and
featureB:api
,
featureB:impl
. Navigating from featureA to featureB using type safe navigation is easy, but what if I want to only use some UI parts from
featureA
in
featureB
? Note: one feature can only depend on the API module of the other feature
The current approach is to create an interface e.g.
FeatureANavigator
inside
featureA:api
, add a
@Composable
function to the interface and implement it inside
featureA:impl
.
To access the composable content,
featureB:impl
has a dependency to
featureA:api
and injects
FeatureANavigator
. Now
featureB
can use the composable that is shared via the interface.
I am wondering if there is an easier strategy someone follows to share modules across feature modules in Android 🤔 . I always need to duplicate the composable API for the interface which is quite annoying