Tagged articles
ViewModel
25 articles · Page 1 of 1
The article distinguishes three lifecycle events that reset UI state — recomposition, configuration change, and process death — and maps each to the appropriate Compose state holder (remember, retain, rememberSaveable, ViewModel) with a counter example, showing how to persist user-modified data and enable JVM unit testing.
AndroidJetpack ComposeLifecycle
0 likes · 18 min read

This article explains why the simple Loading/Success/Error pattern is insufficient for Android Compose pages, demonstrates how to model a comprehensive immutable UI snapshot with data classes, sealed types, and StateFlow, and provides practical guidelines for state ownership, restoration, performance, and testing.
AndroidKotlinState Management
0 likes · 24 min read

TianQu is a pure Kotlin, coroutine-driven routing framework for Kotlin Multiplatform/Compose Multiplatform that supports HarmonyOS, Android, and iOS, featuring compile-time KSP scanning, type-safe navigation, cross-module service discovery, ViewModel lifecycle binding, concurrent preloading, and dynamic feature loading.
AndroidCompose MultiplatformCoroutines
0 likes · 34 min read

This guide explains how to decide whether a piece of state belongs in a Composable or a ViewModel by distinguishing UI state from business state, using clear principles, lifecycle considerations, and concrete code examples such as search bars, expandable cards, and drag‑and‑drop scenarios.
AndroidBusiness StateJetpack Compose
0 likes · 17 min read

This article demonstrates how to implement a custom title bar with window controls, apply dynamic skinning, integrate ViewModel using Precompose, handle network and file I/O, manage multi‑page navigation, open file selectors, and use KV storage in a Kotlin Compose Multiplatform desktop application, with full code examples.
KotlinUIViewModel
0 likes · 9 min read

This article examines common challenges of sharing user interaction logic across multiple Android screens using ViewModel, compares four reuse strategies—including base class inheritance, helper classes, Kotlin class delegation, and interface default functions—and recommends the interface default‑function approach as the most flexible and maintainable solution.
AndroidKotlinMVI
0 likes · 14 min read

This article explains how treating JSON responses as UI components—by converting data models into view‑models on the server and exposing screen‑specific endpoints through a Backend‑for‑Frontend layer—solves the mismatch between REST resources and ever‑changing front‑end requirements.
API DesignBFFJSON
0 likes · 28 min read

The article shows how Trio stores navigation state in a ViewModel‑backed stack, uses type‑safe routers for screen and activity transitions, supports async save‑and‑exit, result‑returning navigation, and interoperates with legacy fragments, enabling modular, testable navigation in Jetpack Compose.
AndroidJetpack ComposeMavericks
0 likes · 14 min read

This article explains how to introduce the ViewModel concept into a Flutter project and use Riverpod 2.0’s NotifierProvider to achieve a clean separation of UI and business logic, illustrated with a complete login‑page example and reusable code snippets.
DartFlutterMVVM
0 likes · 12 min read

This article explains the MVVM (Model-View-ViewModel) architecture for modern Android development, detailing its three core components, their responsibilities, and provides a step‑by‑step example with Jetpack components, including LiveData, ViewModel, View Binding, and complete code snippets to build a simple user list UI.
AndroidJavaKotlin
0 likes · 8 min read

This article introduces the ViewModel concept and demonstrates how to use Riverpod 2.0's NotifierProvider in Flutter to separate UI from business logic, providing step‑by‑step code examples, including model, ViewModel, view, and a complete login page implementation.
MVVMRiverpodState Management
0 likes · 13 min read

This article explains how Android ViewModel preserves UI state across configuration changes, the role of SavedStateHandle and onRetainNonConfigurationInstance, the internal mechanisms involving ComponentActivity and ViewModelStore, and provides practical guidance on using factories, CreationExtras, and Hilt for custom ViewModel implementations.
AndroidJetpackLifecycle
0 likes · 22 min read

This article demonstrates how to create a clean, reusable network request layer for Android using Kotlin, Retrofit, and OkHttp, covering dependency setup, custom token interceptors, Retrofit utility creation, request/result handling with ViewModel extensions, and comprehensive file upload and download implementations.
AndroidFile UploadKotlin
0 likes · 17 min read

This article walks through the design and implementation of an edit screen for the LinkWorld iOS app, showing how to refactor shared UI parts into reusable SwiftUI components, bind them to a data model, and handle navigation, modal presentation, and update logic using a view‑model.
Edit ViewSwiftUIViewModel
0 likes · 13 min read

This tutorial walks through building a minimal MVP for the Linkworld iOS app by applying the MVVM pattern, creating a ViewModel, fetching JSON data with URLSession, and adding, editing, and deleting identity cards using SwiftUI state management and context menus.
JSONMVVMNetworking
0 likes · 11 min read

The article dissects Bilibili’s live‑room architecture, showing how dozens of independent MVVM‑based Views act as business units, explains the coupling problems caused by improper LiveData and cross‑ViewModel references, outlines a service‑driven data‑flow and zone‑based lifecycle model, and proposes systematic refactoring to reduce technical debt and foster shared architectural ownership.
MVVMViewModeldata flow
0 likes · 13 min read

This article introduces Google's recommended MVI (Model-View-Intent) architecture for Android, compares it with MVVM, explains the benefits of unidirectional data flow, and provides practical Kotlin implementations—including LiveData state handling, single-event management, and step-by-step code examples—to guide developers in adopting MVI in mobile projects.
AndroidLiveDataMVI
0 likes · 16 min read

Part 4 of Airbnb’s Android testing series presents a dedicated framework that lets developers write concise, single‑function unit tests for ViewModel classes by specifying initial state, parameters, and expected state or dependency calls through a Kotlin DSL, integrating with JUnit, Robolectric, Mockito, and offering scaffolding and IntelliJ plugins for streamlined, systematic ViewModel logic verification.
AndroidDSLKotlin
0 likes · 12 min read

This article explains how to integrate Retrofit with Kotlin coroutines following Google’s Android architecture guidelines, covering coroutine basics, OkHttp and Retrofit setup, generic response handling, repository abstraction, ViewModel usage, and lifecycle‑aware coroutine scopes to achieve clean, asynchronous network calls.
AndroidKotlin CoroutinesLiveData
0 likes · 13 min read

This article explains the purpose and characteristics of Android Jetpack's ViewModel component, demonstrates how to use it with LiveData in Activities and Fragments, shows code examples for data sharing between fragments, and provides an in‑depth analysis of its internal source code and lifecycle handling.
JetpackLiveDataViewModel
0 likes · 21 min read

The article describes how a Ctrip senior Android engineer uses divide‑and‑conquer, MVP with Clean Architecture, and Jetpack components such as LiveData and ViewModel to break down a highly coupled payment module into reusable view components, improve data flow, and simplify testing and maintenance.
AndroidDivide and ConquerLiveData
0 likes · 10 min read

This article provides a detailed source‑code analysis of Android Jetpack’s Lifecycle, LiveData, and ViewModel components, explaining their architecture, usage examples, internal mechanisms, and offering practical techniques such as bottom‑up and top‑down analysis, code navigation tips, and unit‑test strategies for developers.
AndroidLifecycleLiveData
0 likes · 38 min read

Scene is an open‑source Android framework from ByteDance’s Xigua video team that provides lightweight, view‑based page navigation and composition for Single‑Activity applications, addressing Activity/Fragment limitations with flexible stack management, shared‑element animations, and ViewModel‑based communication.
AndroidFragmentScene
0 likes · 14 min read

By relocating the ViewModel layer to a serverless backend, developers can implement a single, reusable ViewModel as FaaS functions that serve web, native, and mini‑program front‑ends, dramatically cutting duplication, maintenance costs, and development effort while simplifying updates across all platforms.
EfficiencyFaaSViewModel
0 likes · 6 min read

This article introduces Google’s Android Architecture Components—Lifecycle, LiveData, ViewModel, and Room—explaining their principles, how they simplify lifecycle management and data handling, and provides practical integration techniques and best‑practice guidelines for mobile developers.
AndroidArchitecture ComponentsLifecycle
0 likes · 10 min read
