{"id":19674926,"url":"https://github.com/devapro/mvi-kmp","last_synced_at":"2026-06-13T17:02:54.980Z","repository":{"id":261148431,"uuid":"883404092","full_name":"devapro/MVI-KMP","owner":"devapro","description":"Simple MVI for KMP projects","archived":false,"fork":false,"pushed_at":"2024-11-09T22:34:11.000Z","size":64484,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-20T17:29:20.207Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devapro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2024-11-04T22:50:14.000Z","updated_at":"2024-11-05T22:37:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"2d4ee4d5-3988-4cec-bbcf-85538cd90fe0","html_url":"https://github.com/devapro/MVI-KMP","commit_stats":null,"previous_names":["devapro/mvi-kmp"],"tags_count":0,"template":false,"template_full_name":"KevinnZou/compose-multiplatform-library-template","purl":"pkg:github/devapro/MVI-KMP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devapro%2FMVI-KMP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devapro%2FMVI-KMP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devapro%2FMVI-KMP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devapro%2FMVI-KMP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devapro","download_url":"https://codeload.github.com/devapro/MVI-KMP/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devapro%2FMVI-KMP/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34292326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-11T17:20:18.544Z","updated_at":"2026-06-13T17:02:54.958Z","avatar_url":"https://github.com/devapro.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KMP MVI Library\n\nThis is simple a Kotlin Multiplatform library that implements the Model-View-Intent (MVI) architecture pattern.\nOnly a few classes and interfaces are provided to help you implement the MVI pattern in your project.\n\nBased on the [Compose Multiplatform Library Template](https://github.com/KevinnZou/compose-multiplatform-library-template)\n\n## Library Structure\n\nMviViewModel - base class for all ViewModels that should use MVI pattern. It contains:\n- `state` - holds the current state of the UI\n- `event` - channel of event that emits ViewModel for navigation or other actions\n- `onAction` - function that should be called when an action is received from the UI\n\nMviStore - base class for all Stores that should use MVI pattern. It contains all necessary logic to handle actions and update the state.\n\nReducer - interface that should be implemented all reducers that handle actions.\n\nInitialStateFactory - interface that should be implemented according to the initial state for UI.\n\nMviLogger - interface that should be implemented for logging actions and states.\n\n----------------------------------------------------\n\n[![official project](http://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Build Multiplatform project](https://github.com/KevinnZou/compose-multiplatform-library-template/actions/workflows/build.yml/badge.svg)](https://github.com/KevinnZou/compose-multiplatform-library-template/actions/workflows/build.yml)\n[![Publish Wiki](https://github.com/KevinnZou/compose-multiplatform-library-template/actions/workflows/wiki.yml/badge.svg)](https://github.com/KevinnZou/compose-multiplatform-library-template/actions/workflows/wiki.yml)\n# [Compose Multiplatform](https://github.com/JetBrains/compose-multiplatform) Library\n\nThis is a template for a [Compose Multiplatform](https://github.com/JetBrains/compose-multiplatform#readme) **library** targeting desktop,\nAndroid, and iOS. It is built on top of the [Compose Multiplatform Template](https://github.com/JetBrains/compose-multiplatform-template)\nand contains the following changes:\n* Add a `lib` module for the shared library code.\n* Move the androidApp, desktopApp, and iosApp modules to the `samples` folder.\n* Apply the `org.jetbrains.dokka` plugin to generate documentation for the library code.\n* Apply the `com.vanniktech.maven.publish` plugin to streamline the process of publishing a library.\n* Apply the `org.jlleitschuh.gradle.ktlint` plugin to enforce the code style and set up the git hooks to fix the code style before committing automatically.\n* Set up the CI pipeline to build the project, check the code style, and publish the documentation.\n\n## Maven Publish\nThis template applies the `com.vanniktech.maven.publish` plugin to streamline the process of publishing a library.\n\n### Configuring\nTo publish your library properly, you need to configure the necessary information in `mavenPublishing` block in `build.gradle.kts`\n```kotlin\nmavenPublishing {\n    // publishToMavenCentral(SonatypeHost.DEFAULT)\n    // or when publishing to https://s01.oss.sonatype.org\n    publishToMavenCentral(SonatypeHost.S01, automaticRelease = true)\n    signAllPublications()\n    coordinates(\"com.example.mylibrary\", \"mylibrary-runtime\", \"1.0.0\")\n\n    pom {\n        name.set(project.name)\n        description.set(\"A description of what my library does.\")\n        inceptionYear.set(\"2023\")\n        url.set(\"https://github.com/username/mylibrary/\")\n        licenses {\n            license {\n                name.set(\"The Apache License, Version 2.0\")\n                url.set(\"http://www.apache.org/licenses/LICENSE-2.0.txt\")\n                distribution.set(\"http://www.apache.org/licenses/LICENSE-2.0.txt\")\n            }\n        }\n        developers {\n            developer {\n                id.set(\"username\")\n                name.set(\"User Name\")\n                url.set(\"https://github.com/username/\")\n            }\n        }\n        scm {\n            url.set(\"https://github.com/username/mylibrary/\")\n            connection.set(\"scm:git:git://github.com/username/mylibrary.git\")\n            developerConnection.set(\"scm:git:ssh://git@github.com/username/mylibrary.git\")\n        }\n    }\n}\n```\n\n### Secrets\nFor the publishing to work the credentials for Sonatype OSS as well as for the GPG key that is used for signing need to provided. To keep them out of version control it is recommended to either put this into the gradle.properties file user home or to use environment variables for publishing from CI servers.\n```kotlin\nmavenCentralUsername=username\nmavenCentralPassword=the_password\n\nsigning.keyId=12345678\nsigning.password=some_password\nsigning.secretKeyRingFile=/Users/yourusername/.gnupg/secring.gpg\n```\n\nPlease visit https://vanniktech.github.io/gradle-maven-publish-plugin/central/#configuring-maven-central for detailed instructions.\n\n## KtLint\n\nThis template applies the `org.jlleitschuh.gradle.ktlint` plugin to enforce the code style. \nTo check the code style, run the following command:\n```shell\n./gradlew ktlintCheck\n```\nTo automatically fix the code style, run the following command:\n```shell\n./gradlew ktlintFormat\n```\n\nThis template also setup the git hooks to fix the code style before committing automatically.\nTo install the git hooks, run the following command:\n```shell\n./gradlew setUpGitHooks\n```\nThen you can commit the code without worrying about the code style.\n\n## Dokka\n\nThis template applies the `org.jetbrains.dokka` plugin to generate documentation for the library code.\nTo generate the documentation, run the following command:\n```shell\n./gradlew dokkaHtmlMultiModule\n```\nThe documentation will be generated in the `build/dokka/htmlMultiModule` folder.\n\n## CI/CD\nThis template uses GitHub Actions to set up a CI/CD pipeline. \nCurrently, the pipeline is configured to do three things:\n\n### Build the project\nThe pipeline is triggered on every push to the `main` branch or on every pull request.\nIt builds the project and runs the tests.\n\nThe pipeline is defined in [`.github/workflows/build.yml`](https://github.com/KevinnZou/compose-multiplatform-library-template/blob/feature/ci_support/.github/workflows/build.yml).\n\n### Check the code style\nThe pipeline is triggered on every push to the `main` branch or on every pull request.\nIt checks the code style and fails if the code style is not correct.\n\nThe pipeline is defined in [`.github/workflows/code_style.yml`](https://github.com/KevinnZou/compose-multiplatform-library-template/blob/feature/ci_support/.github/workflows/code_style.yml).\n\nIf the code style is not correct, you can run the following command to fix it:\n```shell\n./gradlew ktlintFormat\n```\n\n### Publish the documentation\nThe pipeline is triggered on every push to the `main` branch or on every pull request.\nIt generates the documentation and publishes it to GitHub Pages.\n\nThe pipeline is defined in [`.github/workflows/wiki.yml`](https://github.com/KevinnZou/compose-multiplatform-library-template/blob/feature/ci_support/.github/workflows/wiki.yml).\n\n## Set up the environment\n\n\u003e **Note**\n\u003e The iOS part of Compose Multiplatform is in Alpha. It may change incompatibly and require manual migration in the\n\u003e future.\n\u003e If you have any issues, please report them on [GitHub](https://github.com/JetBrains/compose-multiplatform/issues).\n\nYou can use this template to start developing your\nown [Compose Multiplatform](https://github.com/JetBrains/compose-multiplatform#readme) library targeting desktop,\nAndroid, and iOS.\nFollow our tutorial below to get your first Compose Multiplatform app up and running.\nThe result will be a [Kotlin Multiplatform](https://kotlinlang.org/docs/multiplatform.html) project that uses the\nCompose Multiplatform UI framework.\n\n\u003cimg src=\"readme_images/banner.png\" height=\"350\"\u003e\n\n\n\u003e **Warning**\n\u003e You need a Mac with macOS to write and run iOS-specific code on simulated or real devices.\n\u003e This is an Apple requirement.\n\nTo work with this template, you need the following:\n\n* A machine running a recent version of macOS\n* [Xcode](https://apps.apple.com/us/app/xcode/id497799835)\n* [Android Studio](https://developer.android.com/studio)\n* The [Kotlin Multiplatform Mobile plugin](https://plugins.jetbrains.com/plugin/14936-kotlin-multiplatform-mobile)\n\n### Check your environment\n\nBefore you start, use the [KDoctor](https://github.com/Kotlin/kdoctor) tool to ensure that your development environment\nis configured correctly:\n\n1. Install KDoctor with [Homebrew](https://brew.sh/):\n\n    ```text\n    brew install kdoctor\n    ```\n\n2. Run KDoctor in your terminal:\n\n    ```text\n    kdoctor\n    ```\n\n   If everything is set up correctly, you'll see valid output:\n\n   ```text\n   Environment diagnose (to see all details, use -v option):\n   [✓] Operation System\n   [✓] Java\n   [✓] Android Studio\n   [✓] Xcode\n   [✓] Cocoapods\n   \n   Conclusion:\n     ✓ Your system is ready for Kotlin Multiplatform Mobile development!\n   ```\n\nOtherwise, KDoctor will highlight which parts of your setup still need to be configured and will suggest a way to fix\nthem.\n\n## Examine the project structure\n\nOpen the project in Android Studio and switch the view from **Android** to **Project** to see all the files and targets\nbelonging to the project:\n\n\u003cimg src=\"readme_images/open_project_view.png\" height=\"300px\"\u003e\n\nYour Compose Multiplatform project includes 4 modules:\n\n### `shared`\n\nThis is a Kotlin module that contains the logic common for desktop, Android, and iOS applications, that is, the code you\nshare between platforms.\n\nThis `shared` module is also where you'll write your Compose Multiplatform code.\nIn `shared/src/commonMain/kotlin/App.kt`, you can find the shared root `@Composable` function for your app.\n\nIt uses Gradle as the build system. You can add dependencies and change settings in `shared/build.gradle.kts`.\nThe `shared` module builds into a Java library, an Android library, and an iOS framework.\n\n### `desktopApp`\n\nThis is a Kotlin module that builds into a desktop application. It uses Gradle as the build system. The `desktopApp`\nmodule depends on and uses the `shared` module as a regular library.\n\n### `androidApp`\n\nThis is a Kotlin module that builds into an Android application. It uses Gradle as the build system.\nThe `androidApp` module depends on and uses the `shared` module as a regular Android library.\n\n### `iosApp`\n\nThis is an Xcode project that builds into an iOS application.\nIt depends on and uses the `shared` module as a CocoaPods dependency.\n\n## Run your application\n\n### On desktop\n\nTo run your desktop application in Android Studio, select `desktopApp` in the list of run configurations and click **Run**:\n\n\u003cimg src=\"readme_images/run_on_desktop.png\" height=\"60px\"\u003e\u003cbr /\u003e\n\n\u003cimg src=\"readme_images/desktop_app_running.png\" height=\"300px\"\u003e\n\nYou can also run Gradle tasks in the terminal:\n\n* `./gradlew run` to run application\n* `./gradlew package` to store native distribution into `build/compose/binaries`\n\n### On Android\n\nTo run your application on an Android emulator:\n\n1. Ensure you have an Android virtual device available.\n   Otherwise, [create one](https://developer.android.com/studio/run/managing-avds#createavd).\n2. In the list of run configurations, select `androidApp`.\n3. Choose your virtual device and click **Run**:\n\n    \u003cimg src=\"readme_images/run_on_android.png\" height=\"60px\"\u003e\u003cbr /\u003e      \n\n    \u003cimg src=\"readme_images/android_app_running.png\" height=\"300px\"\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eAlternatively, use Gradle\u003c/summary\u003e\n\nTo install an Android application on a real Android device or an emulator, run `./gradlew installDebug` in the terminal.\n\n\u003c/details\u003e\n\n### On iOS\n\n#### Running on a simulator\n\nTo run your application on an iOS simulator in Android Studio, modify the `iosApp` run configuration:\n\n1. In the list of run configurations, select **Edit Configurations**:\n\n   \u003cimg src=\"readme_images/edit_run_config.png\" height=\"200px\"\u003e\n\n2. Navigate to **iOS Application** | **iosApp**.\n3. In the **Execution target** list, select your target device. Click **OK**:\n\n   \u003cimg src=\"readme_images/target_device.png\" height=\"400px\"\u003e\n\n4. The `iosApp` run configuration is now available. Click **Run** next to your virtual device:\n\n   \u003cimg src=\"readme_images/ios_app_running.png\" height=\"300px\"\u003e\n\n#### Running on a real iOS device\n\nYou can run your Compose Multiplatform application on a real iOS device for free.\nTo do so, you'll need the following:\n\n* The `TEAM_ID` associated with your [Apple ID](https://support.apple.com/en-us/HT204316)\n* The iOS device registered in Xcode\n\n\u003e **Note**\n\u003e Before you continue, we suggest creating a simple \"Hello, world!\" project in Xcode to ensure you can successfully run\n\u003e apps on your device.\n\u003e You can follow the instructions below or watch\n\u003e this [Stanford CS193P lecture recording](https://youtu.be/bqu6BquVi2M?start=716\u0026end=1399).\n\n\u003cdetails\u003e\n\u003csummary\u003eHow to create and run a simple project in Xcode\u003c/summary\u003e\n\n1. On the Xcode welcome screen, select **Create a new project in Xcode**.\n2. On the **iOS** tab, choose the **App** template. Click **Next**.\n3. Specify the product name and keep other settings default. Click **Next**.\n4. Select where to store the project on your computer and click **Create**. You'll see an app that displays \"Hello,\n   world!\" on the device screen.\n5. At the top of your Xcode screen, click on the device name near the **Run** button.\n6. Plug your device into the computer. You'll see this device in the list of run options.\n7. Choose your device and click **Run**.\n\n\u003c/details\u003e\n\n##### Finding your Team ID\n\nIn the terminal, run `kdoctor --team-ids` to find your Team ID.\nKDoctor will list all Team IDs currently configured on your system, for example:\n\n```text\n3ABC246XYZ (Max Sample)\nZABCW6SXYZ (SampleTech Inc.)\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eAlternative way to find your Team ID\u003c/summary\u003e\n\nIf KDoctor doesn't work for you, try this alternative method:\n\n1. In Android Studio, run the `iosApp` configuration with the selected real device. The build should fail.\n2. Go to Xcode and select **Open a project or file**.\n3. Navigate to the `iosApp/iosApp.xcworkspace` file of your project.\n4. In the left-hand menu, select `iosApp`.\n5. Navigate to **Signing \u0026 Capabilities**.\n6. In the **Team** list, select your team.\n\nIf you haven't set up your team yet, use the **Add account** option and follow the steps.\n\n\u003c/details\u003e\n\nTo run the application, set the `TEAM_ID`:\n\n1. In the template, navigate to the `iosApp/Configuration/Config.xcconfig` file.\n2. Set your `TEAM_ID`.\n3. Re-open the project in Android Studio. It should show the registered iOS device in the `iosApp` run configuration.\n\n## Make your first changes\n\nYou can now make some changes in the code and check that they are visible in both the iOS and Android applications at\nthe same time:\n\n1. In Android Studio, navigate to the `shared/src/commonMain/kotlin/App.kt` file.\n   This is the common entry point for your Compose Multiplatform app.\n\n   Here, you see the code responsible for rendering the \"Hello, World!\" button and the animated Compose Multiplatform logo:\n   \n   ```kotlin\n   @OptIn(ExperimentalResourceApi::class)\n   @Composable\n   internal fun App() {\n       MaterialTheme {\n           var greetingText by remember { mutableStateOf(\"Hello, World!\") }\n           var showImage by remember { mutableStateOf(false) }\n           Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {\n               Button(onClick = {\n                   greetingText = \"Hello, ${getPlatformName()}\"\n                   showImage = !showImage\n               }) {\n                   Text(greetingText)\n               }\n               AnimatedVisibility(showImage) {\n                   Image(\n                       painterResource(\"compose-multiplatform.xml\"),\n                       null\n                   )\n               }\n           }\n       }\n   }\n   ```\n\n2. Update the shared code by adding a text field that will update the name displayed on the button:\n\n   ```diff\n   @OptIn(ExperimentalResourceApi::class)\n   @Composable\n   internal fun App() {\n       MaterialTheme {\n           var greetingText by remember { mutableStateOf(\"Hello, World!\") }\n           var showImage by remember { mutableStateOf(false) }\n           Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {\n               Button(onClick = {\n                   greetingText = \"Hello, ${getPlatformName()}\"\n                   showImage = !showImage\n               }) {\n                   Text(greetingText)\n               }\n   +           TextField(greetingText, onValueChange = { greetingText = it })\n               AnimatedVisibility(showImage) {\n                   Image(\n                       painterResource(\"compose-multiplatform.xml\"),\n                       null\n                   )\n               }\n           }\n       }\n   }\n   ```\n\n3. Re-run the `desktopApp`, `androidApp`, and `iosApp` configurations. You'll see this change reflected in all three\n   apps:\n\n   \u003cimg src=\"readme_images/text_field_added.png\" height=\"350px\"\u003e\n\n## How to configure the iOS application\n\nTo get a better understanding of this template's setup and learn how to configure the basic properties of your iOS app without Xcode,\nopen the `iosApp/Configuration/Config.xcconfig` file in Android Studio. The configuration file contains:\n\n* `APP_NAME`, a target executable and an application bundle name.\n* `BUNDLE_ID`,\n  which [uniquely identifies the app throughout the system](https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleidentifier#discussion).\n* `TEAM_ID`, [a unique identifier generated by Apple that's assigned to your team](https://developer.apple.com/help/account/manage-your-team/locate-your-team-id/#:~:text=A%20Team%20ID%20is%20a,developer%20in%20App%20Store%20Connect).\n\nTo configure the `APP_NAME` option, open `Config.xcconfig` in any text editor *before opening* the project in Android\nStudio, and then set the desired name.\n\nIf you need to change this option after you open the project in Android Studio, do the following:\n\n1. Close the project in Android Studio.\n2. Run `./cleanup.sh` in your terminal.\n3. Change the setting.\n4. Open the project in Android Studio again.\n\nTo configure advanced settings, use Xcode. After opening the project in Android Studio,\nopen the `iosApp/iosApp.xcworkspace` file in Xcode and make changes there.\n\n## Next steps\n\nWe encourage you to explore Compose Multiplatform further and try out more projects:\n\n* [Create an application targeting iOS and Android with Compose Multiplatform](https://github.com/JetBrains/compose-multiplatform-ios-android-template#readme)\n* [Create an application targeting Windows, macOS, and Linux with Compose Multiplatform for Desktop](https://github.com/JetBrains/compose-multiplatform-desktop-template#readme)\n* [Complete more Compose Multiplatform tutorials](https://github.com/JetBrains/compose-multiplatform/blob/master/tutorials/README.md)\n* [Explore some more advanced Compose Multiplatform example projects](https://github.com/JetBrains/compose-multiplatform/blob/master/examples/README.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevapro%2Fmvi-kmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevapro%2Fmvi-kmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevapro%2Fmvi-kmp/lists"}