Setup

VIE ships two artifacts:

Artifact Purpose

org.kodein.arch.vie:vie-mvi

The library: the contract, the ViewModel, the view, middlewares, and EmptyVIE for previews.

org.kodein.arch.vie:vie-test

The test helpers: MockVIE to test a view, runVMTest to test a ViewModel.

VIE 0.1.0 is built with Kotlin 2.4.20 and Compose Multiplatform 1.12.0. Use these versions or newer.

An Android target needs a minSdk of 26 or more, and the JVM artifact is built for Java 17, so it needs a JDK 17 or later. A module that writes views also needs the Kotlin Compose compiler plugin, which Compose projects already apply.

Kotlin Multiplatform

Add vie-mvi to the common code, and vie-test to the common tests:

build.gradle.kts
kotlin {
    sourceSets {
        commonMain.dependencies {
            implementation("org.kodein.arch.vie:vie-mvi:0.1.0")
        }
        commonTest.dependencies {
            implementation("org.kodein.arch.vie:vie-test:0.1.0") (1)
        }
    }
}
1 A separate artifact, so the test helpers never reach a production source set.

JVM or Android only

A project with a single platform adds the same artifacts to its dependencies:

build.gradle.kts
dependencies {
    implementation("org.kodein.arch.vie:vie-mvi:0.1.0")
    testImplementation("org.kodein.arch.vie:vie-test:0.1.0")
}

What comes along

VIE’s own signatures use Compose, ViewModel and coroutines types, so these come along as transitive dependencies:

  • org.jetbrains.compose.runtime:runtime, since VIEView and SignalEffect are @Composable;

  • org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose, since VIEViewModel extends ViewModel;

  • org.jetbrains.kotlinx:kotlinx-coroutines-core, since models and signals are flows.

vie-test also brings org.jetbrains.kotlinx:kotlinx-coroutines-test, which runVMTest is built on.

VIE does not bring Compose Foundation or Material: your views use whichever components you choose.

Supported platforms

Both artifacts target:

  • JVM;

  • Android, API 26 and later;

  • iOS: iosArm64 and iosSimulatorArm64;

  • JS, in the browser;

  • Wasm/JS, in the browser.