Skip to content

Instantly share code, notes, and snippets.

@Morfly
Last active October 27, 2022 05:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Morfly/9416f20cfc71ae4af5dbc20a03f87b20 to your computer and use it in GitHub Desktop.
Save Morfly/9416f20cfc71ae4af5dbc20a03f87b20 to your computer and use it in GitHub Desktop.
class MovieSearchEntryImpl @Inject constructor() : MovieSearchEntry() {
@Composable
override fun Composable(...) {
val dataProvider = LocalDataProvider.current
val viewModel = injectedViewModel {
DaggerMovieSearchComponent.builder()
.dataProvider(dataProvider)
.build()
.viewModel
}
MovieSearchScreen(viewModel, ...)
}
}
import androidx.lifecycle.ViewModel
class MovieSearchViewModel @Inject constructor(...) : ViewModel() { ... }
@Composable
fun MovieSearchScreen(viewModel: MovieSearchViewModel, ...) { ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment