package Ġcom . example . personal blog . ui . Main Ċ Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġandroidx . lifecycle . Transform ations Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġcom . example . personal blog . logic . Repository Ċ import Ġcom . example . personal blog . logic . model . Article Ċ Ċ class ĠMain ViewModel : ViewModel () Ġ{ ĊĠĠĠ Ġprivate Ġval Ġarticle LiveData = Mutable LiveData < Any ?> () ĊĊĠĠĠ Ġval Ġarticle List = ArrayList < Article >() ĊĊĠĠĠ Ġval ĠgetAll Result = Transform ations . switch Map ( article LiveData ){ ĊĠĠĠĠĠĠĠ ĠRepository . getAll Article () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠgetAll (){ ĊĠĠĠĠĠĠĠ Ġarticle LiveData . value = article LiveData . value ĊĠĠĠ Ġ} Ċ }