{"repo":"takahirom/Rin","free":true,"listed":false,"github":"https://github.com/takahirom/Rin","clone":"git clone https://github.com/takahirom/Rin.git","description":"Enhance Compose Multiplatform with \"rememberRetained{}\", inspired by Circuit. Successfully used in DroidKaigi 2024 app with no issues. Improve state management using Compose! 🔄✨","language":"Kotlin","stars":145,"topics":["compose-multiplatform","jetpack-compose","kotlin-multiplatform"],"license":"Apache-2.0","category":"mobile-apps","readme_excerpt":"Rin (輪) \"Rin\" means \"circle\" in Japanese. This library enhances Compose Multiplatform by enabling the use of rememberRetained{} , which is stored within ViewModel. It broadens the versatility of Compose, allowing it to be utilized in a wider array of contexts and scenarios. Motivation I believe Compose not only simplifies building UI components but also makes creating foundational elements like ViewModel and Repository more straightforward with composable functions. Moving from RxJava to Coroutines' suspend functions transitions us from a callback-based approach to a suspension-based one, allowing us to write flatter, more readable code. Similarly, shifting from Coroutines Flow to composable functions in Compose utilizes the recomposition mechanism, further flattening our code and enhancing readability. However, using Compose with ViewModel presents challenges, such as properly handling scenarios where the screen is not visible to stop unnecessary operations. Initially, I integrated ViewModel with Molecule, but making it aware of the lifecycle was tougher than expected. Then, I discovered a blog titled \"Retaining beyond ViewModels\" which is an insightful article. It discusses how Circuit effectively manages lifecycles by retaining Presenters within Compositions. I found Circuit particularly beneficial for its use of Compose's lifecycle for state management and its support for rememberRetained{} , mirroring ViewModel's lifecycle. However, adopting Circuit entails migrating all","default_branch":null,"files":null,"tree":[],"storefront":"/r/takahirom","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/takahirom/Rin/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."}