How tencent-tds/kuiklyui works
Project type and purpose
• This is an open-source, cross-platform UI framework (Kuikly) built with Kotlin Multiplatform.
• It supplies a unified core runtime (layout, rendering, event dispatch, DSL) plus platform-specific renderer modules for Android and iOS.
• It also includes code-generation/annotation-processing modules and two host shell apps (androidApp, iosApp) to demonstrate integration.
File structure
• Top-level modules:
• buildSrc – shared Gradle logic and build variables
• core-annotations, core-kapt, core-ksp – annotation definitions & processors that generate entry points for the core
• core – the multiplatform “business logic” and rendering pipeline abstractions (commonMain + androidMain/jvmMain/iosMain)
• core-render-android – Android-specific rendering implementation producing an AAR
• core-render-ios – iOS-specific rendering implementation producing a framework
• demo – sample code and assets using the library’s DSL
• androidApp, iosApp – host shell projects that consume the published artifacts and launch a Kuikly render view
• Auxiliary files: various Gradle/Kotlin version test scripts, Gradle wrapper, CI config, docs, license.
README for additional insights
• Confirms the layering: “core” for cross-platform, separate renderer modules, annotation-processor modules, host apps, demo.
• Highlights technologies: Kotlin Multiplatform, Gradle, KAPT, KSP, CocoaPods, Android Studio, Xcode.
Components
a. Build & code-generation layer
• Gradle (+ buildSrc) orchestrates compilation.
• core-annotations defines @Page etc.
• core-kapt / core-ksp generate entry boilerplate (KuiklyCoreProcessor)
b. Core runtime layer
• core module (commonMain) implements: UI tree, layout (Flex), reactive system, event dispatch, modules (Router, Network, etc.).
• Platform bridges (NativeBridge) provide serialization & communication.
c. Platform renderer layer
• core-render-android: IKuiklyRenderView → Android ViewAdapterManager → native Canvas/Views
• core-render-ios: KuiklyRenderView → native CALayer/UIView renderers
d. Host shell & demo apps
• androidApp & iosApp import published artifacts (.aar, .framework).
• Demo assets/JSON/PAG files feed the core runtime.
e. External services & tools
• Kotlin MPP plugin, Gradle Daemon, AAPT (Android), CocoaPods / Xcode (iOS).
Relationships & interactions
• Build flow: Gradle → annotation processors → compile core + renderers → produce artifacts
• Runtime flow: Host App → instantiate KuiklyRenderView → load JSON/DSL → Core runtime builds VirtualView tree → renderer adapter draws native UI → event callbacks propagate back through NativeBridge → Core signals user code
• Demo app plugs into Core APIs to showcase components and modules (e.g., KRRouterModule).
Architectural patterns & design principles
• Layered architecture: codegen → core runtime → platform adapters → host integration
• Plugin/Module pattern: pluggable modules (Notify, Network, TDF, Performance) registered via ModuleAccessor
• Dependency inversion: core references interfaces (IKuiklyRenderView, IKRImageAdapter) implemented by platform modules
• Reactive & declarative paradigms coexisting: reactive properties + DSL compose
Detail
• Module boundary and interaction point: annotation processor → generated entry → core init → renderer adapter → native view
• Don’t shy away from showing subcomponents: e.g., core-render-android’s AdapterManager, scheduler threads, performance monitors
• The more granular (modules, packages, processors, adapters) you show, the clearer the architecture.