bluelinelabs / Conductor

A small, yet full-featured framework that allows building View-based Android applications
Apache License 2.0
3.9k stars 343 forks source link

implementing Viewmodel #656

Open johnjeremih opened 2 years ago

johnjeremih commented 2 years ago

This is not an issue, but I would like to know how to implement ViewModel using conductor Controller. it doesn't extend from activity nor fragment, is there a way to do it? thanks

hijamoya commented 2 years ago

Use this library https://github.com/FunnyDevs/hilt-conductor.

    private val viewModel by lazy {
        ViewModelProvider(
            this,
            viewModelFactory { ViewModel(repository) }
        ).get(ViewModel::class.java)
    }
johnjeremih commented 2 years ago

@hijamoya Do you have an example where you used it? Thanks