{"id":13537382,"url":"https://github.com/hoc081098/kmp-viewmodel","last_synced_at":"2025-10-26T09:44:17.596Z","repository":{"id":65526362,"uuid":"593616264","full_name":"hoc081098/kmp-viewmodel","owner":"hoc081098","description":"🔆 Kotlin Multiplatform ViewModel. Kotlin Multiplatform MVVM.  Common/Shared ViewModel in Kotlin Multiplatform - A Kotlin Multiplatform library that provides shared MVVM for UI applications. Components are lifecycle-aware on Android. Supports Android Parcelable, Kotlin Parcelize, AndroidX SavedStateHandle for restoring state after process death.","archived":false,"fork":false,"pushed_at":"2024-05-28T22:58:07.000Z","size":4576,"stargazers_count":104,"open_issues_count":19,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-29T02:58:22.469Z","etag":null,"topics":["kmm","kmm-example","kmm-library","kmm-mvvm","kmm-sample","kmm-viewmodel","kmp-library","kmp-mvvm","kmp-redux","kmp-viewmodel","kotlin-multiplaform","kotlin-multiplatform","kotlin-multiplatform-compose-viewmodel","kotlin-multiplatform-library","kotlin-multiplatform-mobile","kotlin-multiplatform-mvvm","kotlin-multiplatform-template","kotlin-multiplatform-viewmodel","mvvm","mvvm-architecture"],"latest_commit_sha":null,"homepage":"https://hoc081098.github.io/kmp-viewmodel/docs/0.x/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hoc081098.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["hoc081098"],"buy_me_a_coffee":"hoc081098"}},"created_at":"2023-01-26T13:05:23.000Z","updated_at":"2024-05-30T06:31:45.142Z","dependencies_parsed_at":"2023-02-15T07:16:49.629Z","dependency_job_id":"e99d8a02-76c4-4dc7-99cf-8a2c748940e2","html_url":"https://github.com/hoc081098/kmp-viewmodel","commit_stats":null,"previous_names":[],"tags_count":11,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoc081098%2Fkmp-viewmodel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoc081098%2Fkmp-viewmodel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoc081098%2Fkmp-viewmodel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoc081098%2Fkmp-viewmodel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoc081098","download_url":"https://codeload.github.com/hoc081098/kmp-viewmodel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248217079,"owners_count":21066633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kmm","kmm-example","kmm-library","kmm-mvvm","kmm-sample","kmm-viewmodel","kmp-library","kmp-mvvm","kmp-redux","kmp-viewmodel","kotlin-multiplaform","kotlin-multiplatform","kotlin-multiplatform-compose-viewmodel","kotlin-multiplatform-library","kotlin-multiplatform-mobile","kotlin-multiplatform-mvvm","kotlin-multiplatform-template","kotlin-multiplatform-viewmodel","mvvm","mvvm-architecture"],"created_at":"2024-08-01T09:00:58.321Z","updated_at":"2025-10-26T09:44:12.564Z","avatar_url":"https://github.com/hoc081098.png","language":"Kotlin","funding_links":["https://github.com/sponsors/hoc081098","https://buymeacoffee.com/hoc081098","https://www.buymeacoffee.com/hoc081098"],"categories":["Libraries"],"sub_categories":["Architecture","🏗 Architecture"],"readme":"# kmp-viewmodel 🔆\n\n## Kotlin Multiplatform ViewModel - Kotlin Multiplatform MVVM - Compose Multiplatform ViewModel\n\nCommon/ Shared ViewModel in **Kotlin Multiplatform** - A Kotlin Multiplatform library that provides shared MVVM\nfor UI applications.\nComponents are **lifecycle-aware on Android**.\nSupports **Android Parcelable**, **Kotlin Parcelize**, **AndroidX SavedStateHandle** for restoring state after process death.\nEasy interoperability with **Swift/Objective-C** and **SwiftUI**.\nSupports **Compose Multiplatform** Framework (Android, Desktop, Web, iOS, macOS, tvOS, watchOS).\n\n\u003e The ViewModel class is a business logic or screen level state holder.\nIt exposes state to the UI and encapsulates related business logic.\nIts principal advantage is that it caches state and persists it through configuration changes (on Android).\n\n## kmp-viewmodel and Navigation for JetBrains Compose Multiplatform 👉 https://github.com/hoc081098/solivagant\n\n[![maven-central](https://img.shields.io/maven-central/v/io.github.hoc081098/kmp-viewmodel)](https://search.maven.org/search?q=g:io.github.hoc081098%20kmp-viewmodel)\n[\u003cimg src=\"https://img.shields.io/nexus/snapshots/https/s01.oss.sonatype.org/io.github.hoc081098/kmp-viewmodel.svg?label=latest%20snapshot\"/\u003e](https://s01.oss.sonatype.org/content/repositories/snapshots/io/github/hoc081098/kmp-viewmodel)\n[![codecov](https://codecov.io/gh/hoc081098/kmp-viewmodel/branch/master/graph/badge.svg?token=jBFg12osvP)](https://codecov.io/gh/hoc081098/kmp-viewmodel)\n[![Build and publish snapshot](https://github.com/hoc081098/kmp-viewmodel/actions/workflows/build.yml/badge.svg)](https://github.com/hoc081098/kmp-viewmodel/actions/workflows/build.yml)\n[![Build sample](https://github.com/hoc081098/kmp-viewmodel/actions/workflows/sample.yml/badge.svg)](https://github.com/hoc081098/kmp-viewmodel/actions/workflows/sample.yml)\n[![Publish Release](https://github.com/hoc081098/kmp-viewmodel/actions/workflows/publish-release.yml/badge.svg)](https://github.com/hoc081098/kmp-viewmodel/actions/workflows/publish-release.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Kotlin version](https://img.shields.io/badge/Kotlin-1.9.22-blueviolet?logo=kotlin\u0026logoColor=white)](https://github.com/JetBrains/kotlin/releases/tag/v1.9.22)\n[![KotlinX Coroutines version](https://img.shields.io/badge/Kotlinx_Coroutines-1.7.3-blueviolet?logo=kotlin\u0026logoColor=white)](https://github.com/Kotlin/kotlinx.coroutines/releases/tag/1.7.3)\n[![Compose Multiplatform version](https://img.shields.io/badge/Compose_Multiplatform-1.5.12-blueviolet?logo=kotlin\u0026logoColor=white)](https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.5.12)\n[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fhoc081098%2Fkmp-viewmodel\u0026count_bg=%2379C83D\u0026title_bg=%23555555\u0026icon=\u0026icon_color=%23E7E7E7\u0026title=hits\u0026edge_flat=false)](https://hits.seeyoufarm.com)\n![badge][badge-jvm]\n![badge][badge-android]\n![badge][badge-js]\n![badge][badge-wasm]\n![badge][badge-nodejs]\n![badge][badge-ios]\n![badge][badge-mac]\n![badge][badge-tvos]\n![badge][badge-watchos]\n\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/hoc081098/kmp-viewmodel/raw/master/logo.png\" width=\"400\"\u003e\n\u003c/p\u003e\n\n\n## Author: [Petrus Nguyễn Thái Học](https://github.com/hoc081098)\n\nLiked some of my work? Buy me a coffee (or more likely a beer)\n\n\u003ca href=\"https://www.buymeacoffee.com/hoc081098\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-blue.png\" alt=\"Buy Me A Coffee\" height=64\u003e\u003c/a\u003e\n\n## Supported targets\n\n- `android`.\n- `jvm` (must add `kotlinx-coroutines-swing`/`kotlinx-coroutines-javafx` to your dependencies to\n  make sure `Dispatchers.Main` available).\n\n\u003e [!NOTE]\n\u003e If you are targeting `Desktop` and:\n\u003e   - not using `JetBrains Compose Multiplatform`, you should provide the dependency `org.jetbrains.kotlinx:kotlinx-coroutines-swing` **or** `org.jetbrains.kotlinx:kotlinx-coroutines-javafx`.\n\u003e   - using `JetBrains Compose Multiplatform`, you should provide `org.jetbrains.kotlinx:kotlinx-coroutines-swing`.\n\u003e\n\u003e Because the `ViewModel.viewModelScope` depends on `Dispatchers.Main` provided by that libraries on Desktop.\n\n- `js` (`IR`).\n- `wasmJs`.\n- `Darwin` targets:\n  - `iosArm64`, `iosX64`, `iosSimulatorArm64`.\n  - `watchosArm32`, `watchosArm64`, `watchosX64`, `watchosSimulatorArm64`.\n  - `tvosX64`, `tvosSimulatorArm64`, `tvosArm64`.\n  - `macosX64`, `macosArm64`.\n\n## Docs\n\n### **0.x release** docs: https://hoc081098.github.io/kmp-viewmodel/docs/0.x\n\n### Snapshot docs: https://hoc081098.github.io/kmp-viewmodel/docs/latest\n\n## Getting started\n\n### 1. `kmp-viewmodel` library\n\nFor more information check out the [docs][1].\n\n### 2. `kmp-viewmodel-savedstate` library\n\nFor more information check out the [docs][2].\n\n### 3. `kmp-viewmodel` and `Swift` interoperability\n\nFor more information check out the [docs][3].\n\n### 4. `kmp-viewmodel-compose` library\n\nFor more information check out the [docs][4].\n\n### 5. `kmp-viewmodel-koin-compose` library\n\nFor more information check out the [docs][5].\n\n### 6. `kmp-viewmodel-koject-compose` library\n\nFor more information check out the [docs][6].\n\n### 7. `kmp-viewmodel` and Navigation for JetBrains Compose Multiplatform.\n\nFor more information check out https://github.com/hoc081098/solivagant library.\n\n## Samples\n\nFor more information check out the [docs][7].\n\n- [KMM sample](https://github.com/hoc081098/kmp-viewmodel/tree/master/sample): shares business logic and `ViewHolder`s, using Jetpack Compose for Android and SwiftUi for iOS.\n- [Compose Multiplatform Koin sample](https://github.com/hoc081098/kmp-viewmodel/tree/master/standalone-sample/kmpviewmodel_compose_koin_sample): shares `ViewModel`s and integrates with `Navigation` in Compose Multiplatform. It uses `Koin` for DI.\n- [Compose Multiplatform Koject sample](https://github.com/hoc081098/kmp-viewmodel/tree/master/standalone-sample/kmpviewmodel_compose_koject_sample): shares `ViewModel`s and integrates with `Navigation` in Compose Multiplatform. It uses `Koject` for DI.\n- [Compose Multiplatform KmpViewModel KMM Unsplash Sample](https://github.com/hoc081098/Compose-Multiplatform-KmpViewModel-KMM-Unsplash-Sample): A KMP template of the Unsplash App using Compose multiplatform for Android, Desktop, iOS. Share everything including data, domain, presentation, and UI.\n- [🍭 GithubSearchKMM](https://github.com/hoc081098/GithubSearchKMM): Github Repos Search KMM for Android and iOS. Kotlin Multiplatform Mobile using Jetpack Compose, SwiftUI, FlowRedux, Coroutines Flow, Dagger Hilt, Koin Dependency Injection, shared KMP ViewModel, Clean Architecture.\n\n## Roadmap\n\n- [x] support `SaveStateHandle` (since [0.2.0](https://github.com/hoc081098/kmp-viewmodel/releases/tag/0.2.0)).\n- [x] add extensions for `Flow`/`StateFlow`, to use the ViewModel easily on `ios`/`macOS`/`tvOS`/`watchOS` platforms\n  (since [0.3.0](https://github.com/hoc081098/kmp-viewmodel/releases/tag/0.3.0)).\n- [x] support `Compose Multiplatform Framework` (since [0.5.0](https://github.com/hoc081098/kmp-viewmodel/releases/tag/0.5.0)).\n- [x] support `Koin` integration with ViewModel and `JetBrains Compose Multiplatform` (since [0.6.2](https://github.com/hoc081098/kmp-viewmodel/releases/tag/0.6.2)).\n\n## License\n\n```license\nMIT License\nCopyright (c) 2023-2024 Petrus Nguyễn Thái Học\n```\n\n[badge-android]: http://img.shields.io/badge/android-6EDB8D.svg?style=flat\n\n[badge-ios]: http://img.shields.io/badge/ios-CDCDCD.svg?style=flat\n\n[badge-js]: http://img.shields.io/badge/js-F8DB5D.svg?style=flat\n\n[badge-jvm]: http://img.shields.io/badge/jvm-DB413D.svg?style=flat\n\n[badge-linux]: http://img.shields.io/badge/linux-2D3F6C.svg?style=flat\n\n[badge-windows]: http://img.shields.io/badge/windows-4D76CD.svg?style=flat\n[badge-mac]: http://img.shields.io/badge/macos-111111.svg?style=flat\n[badge-watchos]: http://img.shields.io/badge/watchos-C0C0C0.svg?style=flat\n[badge-tvos]: http://img.shields.io/badge/tvos-808080.svg?style=flat\n[badge-wasm]: https://img.shields.io/badge/wasm-624FE8.svg?style=flat\n[badge-nodejs]: https://img.shields.io/badge/nodejs-68a063.svg?style=flat\n\n[1]: https://hoc081098.github.io/kmp-viewmodel/docs/0.x/viewmodel/\n[2]: https://hoc081098.github.io/kmp-viewmodel/docs/0.x/viewmodel-savedstate/\n[3]: https://hoc081098.github.io/kmp-viewmodel/docs/0.x/swift-interop/\n[4]: https://hoc081098.github.io/kmp-viewmodel/docs/0.x/viewmodel-compose/\n[5]: https://hoc081098.github.io/kmp-viewmodel/docs/0.x/viewmodel-koin-compose/\n[6]: https://hoc081098.github.io/kmp-viewmodel/docs/0.x/viewmodel-koject-compose/\n[7]: https://hoc081098.github.io/kmp-viewmodel/docs/0.x/samples\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoc081098%2Fkmp-viewmodel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoc081098%2Fkmp-viewmodel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoc081098%2Fkmp-viewmodel/lists"}