/ComposeArcade

A Sudoku game for Android & Desktop written with Jetpack Compose Multiplatform

Primary LanguageKotlin

🚀 Compose Arcade

A sample Kotlin Multiplatform Compose Sudoku app for Android & Desktop. Most code is shared between Android & Desktop using Kotlin Multiplatform and Jetbrains Compose.

Alt text

This example supports the following targets:

  • Android (Compose)
  • JVM (Compose - Win / Linux / MacOS)

Libraries used:

  • Jetpack Compose - shared UI
  • Decompose - navigation and lifecycle
  • Mavericks - state management using MVI. For this project I created a minimalistic multi-platform ViewModel implementation using MavericksStateStore.
  • Sudoku Game Logic A Sudoku generator and solver, ported to Kotlin multi-platform.

There are multiple modules:

  • :common:sudoku - displays a list of todo items and a text field
  • :common:utils - some shared utilities, including the state management classes
  • :common:root - UI entrypoint and navigation logic
  • :common:compose-ui - platform specific UI implementations (expect/actual funs)
  • :android - Android application
  • :desktop - Desktop application

The root module is integrated into Android and Desktop apps.

Features:

  • 99% of the code is shared: data, business logic, presentation, navigation and UI
  • View state is preserved when navigating between screens, Android configuration change, etc.
  • Model-View-Intent (aka MVI) architectural pattern

Running desktop application

./gradlew :desktop:run

Building native desktop distribution

./gradlew :desktop:package
# outputs are written to desktop/build/compose/binaries

Running Android application

Open project in Intellij IDEA or Android Studio and run "android" configuration.