Conductor Viewmodel

Adds ViewModel and LiveData support to Conductor library
Alternatives To Conductor Viewmodel
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
6 months ago11apache-2.0Kotlin
:chicken::basketball:一个Jetpack结合MVVM的快速开发框架,基于MVVM模式集成谷歌官方推荐的JetPack组件库:LiveData、ViewModel、Lifecycle、Navigation组件 使用Kotlin语言,添加大量拓展函数,简化代码 加入Retrofit网络请求,协程,帮你简化各种操作,让你快速开发项目
Awesome Android Kotlin Apps1,947
23 days ago12Kotlin
👓 A curated list of awesome android kotlin apps by open-source contributors.
Kotlin Pokedex1,393
3 days ago27mitKotlin
:cyclone: A Pokedex app using ViewModel, ViewBinding, LiveData, Room and Navigation
10 months agoapache-2.0Kotlin
🦁 A Disney app using transformation motions based on MVVM (ViewModel, Coroutines, Flow, Room, Repository, Koin) architecture.
Conference App 20181,297
4 years ago31apache-2.0Kotlin
The Official Conference App for DroidKaigi 2018 Tokyo
8 months ago8gpl-3.0Kotlin
Jetpack MVVM For Wanandroid 最佳实践 !
Mvvm Kotlin Android Architecture1,147
2 years ago6apache-2.0Kotlin
MVVM + Kotlin + Retrofit2 + Hilt + Coroutines + Kotlin Flow + mockK + Espresso + Junit5
3 years ago11Java
Recommended architecture by Android
Awesome Jetpack Compose Android Apps828
a month ago3Kotlin
👓 A curated list of awesome Jetpack Compose android apps by open-source contributors.
Jetpack Mvvm Scaffold807
5 months ago2Java
人生苦短,让脚手架为你节省时间。(目前作为《最佳实践》项目的 Dev 版优先更新)
Alternatives To Conductor Viewmodel
Select To Compare

Alternative Project Comparisons


The library has been archived. I can't provide support anymore as I no longer use Conductor and instead I use Navigation Component on my projects.

You can still use the library as it is, but I won't be adding new features or reviewing PRs from now on.

Feel free to fork and do any changes or continue supporting it by yourself, but please keep the license and copyright notices.

Miguel, author of the library.

ViewModel support for Conductor

This library adds support for the ViewModel from Architecture Components to the Conductor library.


How it works

A ViewModelController is provided that contains all the necessary things to create ViewModels and observe LiveData.

The ViewModelController is a LifecycleOwner that also provides the necessary events for observing LiveData.

The ViewModelController contains its own ViewModelStore, which contains the ViewModels. As Controllers survive configuration changes, the ViewModels will do as well.

How to use it

// 1. Create a new Controller by extending the ViewModelController.
class MyViewModelController : ViewModelController() {

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup): View {
        val view = inflater.inflate(R.layout.controller_viewmodel, container, false)

        // 2. Obtain your ViewModel using the viewModelProvider() method
        val viewModel = viewModelProvider().get(
        // 2.1 You can also provide a factory to viewModelProvider
        // val viewModel = viewModelProvider(factory).get(

        // 3. Observe your LiveData
        viewModel.getLiveData().observe(this, Observer<String> {

        return view


This library depends on Architecture Components and Conductor.

Those two components are NOT provided and need to be added to your project separately.

Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        maven { url '' }

Step 2. Add the dependency

dependencies {
    implementation "com.github.miquelbeltran:conductor-viewmodel:1.0.3"


When is the LiveData observer detached?

The LiveData observer will be removed (detached) after onDestroyView is called. You don't need to remove the observer manually

When should I start observing my LiveData?

Call to liveData.observe() on the onCreateView method.

How can I provide a ViewModel factory?

Call viewModelProvider and pass your factory as the first parameter.

val viewModel = viewModelProvider(factory).get(

How can I access to the ViewModel of the parent Controller?

Cast the parentController as ViewModelController, then access the same ViewModelProvider using viewModelProvider(), that should give you access to the same ViewModel instance.

val viewModelFromParent = (parentController as ViewModelController)

Are there any samples?

A sample project is included in the app module.

Why there are no tests?

I will add Espresso tests in the future to verify that lifecycle events happen correctly.

Why is the ON_DESTROY event in onDestroyView?

In order to remove the observers from the LiveData when the view is destroyed.


Conductor is a library by BlueLine Labs, Inc. bluelinelabs/Conductor

Conductor ViewModel is a library by Miquel Beltran

Copyright 2018 Miquel Beltran - BELTRAN.WORK

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
Popular Livedata Projects
Popular Viewmodel Projects
Popular User Interface Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Architecture Components