Overview of Kuikly
main.aar, .framework, and .so files, and supports both declarative and reactive programming paradigms using custom and Compose DSLs.repository·main·Indexed 25 days ago
https://github.com/tencent-tds/kuiklyuiA high-performance, cross-platform UI and logic framework built on Kotlin Multiplatform. Kuikly enables a single codebase for Android, iOS, HarmonyOS, Web, Mini Programs, and macOS. Documentation includes environment setup for HarmonyOS (DevEco Studio 5.1.0+), integration guides, JS module migration for Webpack, and details on the integrated cJSON lightweight JSON parser.
.aar, .framework, and .so files, and supports both declarative and reactive programming paradigms using custom and Compose DSLs.Kuikly provides a specialized layer for accessing WeChat Mini Program APIs to ensure type safety and prevent business logic from breaking the cross-platform architecture. While Kuikly offers cross-platform modules (like RouterModule or NetworkModule), WeChat-specific APIs (such as wx.login, wx.scanCode, or wx.showToast) require this dedicated integration to maintain native performance and access platform-exclusive features.
There are three ways to access these APIs:
WXApiModule, WXStorageModule, WXUIModule, etc., for type safety and parameter hints.WXRawApiModule): Use wxRaw.call to invoke any wx.xxx method directly without creating a new module.Note: WXxxxModule only functions on the WeChat Mini Program platform. On other platforms, calls will fail with errMsg = "not supported: not in mini-app". To handle cross-platform logic, check pageData.params.optString("is_wx_mp") == "1".
The Kuikly Compose documentation is organized into five primary categories to guide developers from initial setup to advanced cross-platform extension and migration:
Kuikly is a cross-platform UI and logic solution based on Kotlin Multiplatform (KMP). It provides a high-performance framework for developing applications across multiple platforms using a single codebase. It supports declarative and reactive development paradigms, including custom DSL and Compose DSL.
Supported Platforms:
CheckBox component is used to toggle between selected and unselected states via user clicks. It supports custom images and custom view creators for different states (checked, default, and disabled).SharedPreferencesModule is a disk-based key-value cache module designed for storing small amounts of data. It supports String, Float, Int, and JSONObject types.RecompositionProfiler is a built-in tool in Kuikly Compose used to identify recomposition performance issues. It automatically tracks recomposition counts, duration, the State objects triggering changes (prev → now), and parameter-level changes without requiring business code modifications. It supports multiple platforms (iOS, Android, HarmonyOS) and provides a floating overlay for real-time visualization.The Kuikly community provides several entry points for developers:
Kuikly Compose uses a dual-stack architecture where the upper layer provides standard Compose semantics for UI description and state management, while the lower layer uses Kuikly Core for cross-platform rendering and dynamic capabilities.
Key architectural mappings:
androidx to com.tencent.kuikly.compose.*.androidx.compose.runtime (State, Snapshot, Recomposer, SideEffect).AndroidComposeView/Skia with KuiklyApplier which maps Compose tree operations to Kuikly atomic components (KNode).Attr/Event).The KRThread encapsulates a context worker thread using a libuv event loop (uv_loop + uv_async). It provides two primary paths for task dispatching, both of which must ensure that only one thread is executing a task at any given time to prevent corruption of the V8/JS Context or native state.
| Path | Entry Point | Execution Thread | Purpose |
|---|---|---|---|
| Asynchronous Dispatch | DispatchAsync → OnAsync | worker thread | Regular cross-platform tasks, timer callbacks |
| Synchronous Direct Run | DispatchSync → DirectRunOnCurThread | Calling thread (usually main thread) | Fast path for when the main thread needs immediate results from the kuikly side |