https://kotlinlang.org logo
#compose
Title
# compose
f

Franck

02/28/2024, 12:56 PM
and is it recommended to use both fragments and composables within the same Android app?
z

Zach Klippenstein (he/him) [MOD]

02/28/2024, 1:09 PM
I wouldn’t do this unless in a new app you’re using some library that requires fragments. Otherwise it’s just unnecessary complexity
s

Stylianos Gakis

02/28/2024, 1:28 PM
Here’s the only one case where I can imagine someone wanting to do that: • You are using androidx navigation • You want type-safe navigation between your screens • You do not want to use third-party solutions like this, nor do you want to wire everything up together yourself by following the docs • You do want to use the existing “navigation-safe-args-gradle-plugin” gradle plugin as explained here. If someone fulfills all of the above, this would be the last legit reason I can imagine someone having to going that hybrid approach still.
j

Joel Denke

02/28/2024, 2:38 PM
If youre talking about a new app, I would never use Fragments ever again. But if having an app already using Fragments, there is not an issue mixing them. However I recommend having strategy of migrate away from Fragments, if you intend to use Compose. Nothing wrong with Fragments itself, just that I dont see any reasons of using them anymore.
3 Views