I have seen some discussions around avoiding archi...
# compose
a
I have seen some discussions around avoiding architecture component view models in pure compose apps because these ViewModels only work in Android. Does that also mean I should avoid Hilt as well? If yes, what is the recommended way of dependency injection in such apps?
y
A personal opinion, but it seems awkard to ignore the very real lifecycle of ViewModel, Activities, Application. Hilt nicely models this with ViewModelScope, ActivityRetainedScope and so on. Be unfortunate to not be able to se this.
l
It likely depends on if your app is Android-only or if you plan on making it cross platform. If the app will be Android only for the foreseeable future, I would take advantage of the integration between Android libraries. If there's any chance of using KMM in the future, there are plenty of good options like decompose or moko-mvvm that also have good support for SwiftUI for architecture and DI libraries like Koin or Kodein.
k
If you use local or remote data in your app inside it's kind of hard to ignore it. You could ignore it tho, let us know about the results. 🙂
a
I wasn't really going to try this out 😅. I am building android-only apps and love the jetpack libraries, so going to stick with those. I was just wondering if there are some good samples/guidance out there implementing these recommendations.
k
I feel like this is how iOS looks.