{"repo":"sebaslogen/resaca","free":true,"listed":false,"github":"https://github.com/sebaslogen/resaca","clone":"git clone https://github.com/sebaslogen/resaca.git","description":"Compose Multiplatform library to scope ViewModels to a Composable, surviving configuration changes and navigation","language":"Kotlin","stars":648,"topics":["kotlin","android","compose","architecture-components","android-architecture","android-library","hilt-dependency-injection","viewmodel","compose-multiplatform","compose-multiplatform-library"],"license":"MIT","category":"mobile-apps","readme_excerpt":"Article about this library: Every Composable deserves a ViewModel Resaca 🍹 The right scope for objects and View Models in Android Compose. Resaca provides a simple way to keep a Jetpack ViewModel (or any other object) in memory during the lifecycle of a @Composable function and automatically clean it up when not needed anymore. This means, it retains your object or ViewModel across recompositions, during configuration changes, and also when the container Fragment or Compose Navigation destination goes into the backstack. With Resaca you can create fine grained ViewModels for fine grained Composables and finally have reusable components across screens. Why Compose allows the creation of fine-grained UI components that can be easily reused like Lego blocks 🧱. Well architected Android apps isolate functionality in small business logic components (like use cases, interactors, repositories, etc.) that are also reusable like Lego blocks 🧱. Screens are built using Compose components together with business logic components, and the standard tool to connect these two types of components is a Jetpack ViewModel. Unfortunately, ViewModels can only be scoped to a whole screen (or larger scope), but not to smaller Compose components on the screen. In practice, this means that we are gluing UI Lego blocks with business logic Lego blocks using a big glue class for the whole screen, the ViewModel 🗜. Until now... Installation Just include the library (less than 5Kb): Kotlin (KTS) Groovy Us","default_branch":null,"files":null,"tree":[],"storefront":"/r/sebaslogen","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sebaslogen/resaca/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}