Skip to content

Instantly share code, notes, and snippets.

@nomanr
Last active September 21, 2020 12:57
Show Gist options
  • Save nomanr/681c96804a09ecd1405fabe77bbe359d to your computer and use it in GitHub Desktop.
Save nomanr/681c96804a09ecd1405fabe77bbe359d to your computer and use it in GitHub Desktop.
class ExampleFragment: Fragment(){
val args by navArgs<ExampleFragmentArgs>()
//If we don't use Hilt, then create factory for each ViewModel and pass arguments
// Which is even worse
val viewModel by viewModels<ExampleViewModel> {
InjectorUtils.provideExampleViewModelFactory(args.argumentA, args.argumentB)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment