Skip to content

Repository files navigation

Screen.Recording.2026-08-06.at.3.52.45.PM.mp4

KmpWidget

Active development — APIs and architecture are changing. Follow @dev_atrii on X for updates.

WARP — Coming Soon

WARP (Widget Abstraction, Rendering Pipeline) is a unified API for creating home-screen widgets in Kotlin Multiplatform.

Write widget UI once in Kotlin → render on Android (Jetpack Glance) and iOS (WidgetKit + SwiftUI).

Compose-like Kotlin UI  →  WarpNode tree  →  JSON  →  platform renderer
                              ↑
                         shared state & click handlers

Example

Describe widget UI in commonMain with composable primitives — same counter on Android Glance and iOS WidgetKit:

@Composable
fun CounterWidgetUi(state: CounterState) {
    WarpColumn(
        modifier = WarpModifier().padding(WarpPadding(16, 16, 16, 16)),
    ) {
        WarpText("Counter")
        WarpRow {
            WarpButton(text = "-", onClick = CounterActions.Decrement.asClickAction())
            WarpText(state.count.toString())
            WarpButton(text = "+", onClick = CounterActions.Increment.asClickAction())
        }
    }
}

// Compose state → tree → platform render
val node = composeWarp(CounterState(count = count), CounterWidgetUi)
WarpRender(node, counterWidgetClickHandlers(dataStore, widgetUpdater))  // Android Glance
// iOS: renderCounterWidget() → WidgetKit (.systemSmall)

See example/counter/CounterWidget.kt for the full demo.

Modules

Module Role
warp-runtime Author widget UI (WarpColumn, WarpText, WarpButton), compose to tree/JSON, click wire format
warp-ui Platform renderers — Glance (Android), iOS via spm4Kmp
warp-widget Shared WarpWidget definition, session/env, prefs store, host API (WarpWidgetHost)
warpWidgetKit SPM SwiftUI / WidgetKit package (import warpWidgetKit) — local now, remote later
shared App + demo widgets (counter), shared click handlers, DataStore
androidApp Android host app + Glance widget
iosApp iOS host app + Counter Widget extension (.systemSmall)

Docs

Status

Platform Renderer Demo
Android Jetpack Glance ✓ Counter widget ✓
iOS WidgetKit + SwiftUI ✓ Counter widget (.systemSmall) ✓
API stability Early / experimental

Running the apps

  • Android: ./gradlew :androidApp:assembleDebug — install app, add Counter widget from launcher
  • iOS: open iosApp in Xcode, run iosApp, add Counter widget (requires App Group + iOS 17+)

Verify builds

./gradlew :warp-runtime:jvmTest
./gradlew :warp-ui:compileKotlinIosSimulatorArm64
./gradlew :androidApp:assembleDebug

Project layout

  • /iosApp — iOS application and Widget Extension entry points
  • /shared — shared Kotlin (commonMain, androidMain, iosMain)
  • /androidApp — Android application

Learn more about Kotlin Multiplatform.

About

WARP — Widget Abstraction & Rendering Pipeline for KMP. Write widget UI once in Kotlin; render on Android (Glance) and iOS (WidgetKit). Active development.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages