Skip to content

Rename to SwiftUICore/ComposeUI and extract reusable Kotlin libraries#68

Merged
colemancda merged 8 commits into
masterfrom
feature/popover
Jul 24, 2026
Merged

Rename to SwiftUICore/ComposeUI and extract reusable Kotlin libraries#68
colemancda merged 8 commits into
masterfrom
feature/popover

Conversation

@colemancda

Copy link
Copy Markdown
Member

A structural refactor with no behavior change: clearer module boundaries on both the Swift and Kotlin sides, so the reusable pieces stand on their own and the demo is just a consumer. Verified end-to-end on the emulator and the desktop rig.

Swift modules

  • AndroidSwiftUICoreSwiftUICore — the platform-neutral evaluation core (View/State/evaluator/RenderNode IR). No Android imports; builds and tests on any host.
  • AndroidSwiftUIBridgeComposeUI — the JNI materializer/bridge to the Compose interpreter. Platform-neutral (desktop JVM + Android).
  • AndroidSwiftUI now @_exported imports both SwiftUICore and ComposeUI, and adds only the Android host (android.view bridging: MainActivity, Application, host view). App code keeps importing the one umbrella.

The demo's shared sources gate the desktop branch on canImport(ComposeUI) (a unique name) rather than canImport(SwiftUICore) — Apple ships a private SwiftUICore framework that would otherwise collide.

Kotlin libraries (extracted to repo root)

The Gradle build moved from Demo/ to the repo root, and the reusable Kotlin now lives in two root modules, with the demo consuming them:

  • :composeui — the Compose Multiplatform interpreter (was Demo/swiftui, com.pureswift.swiftui): Render, ViewNode, TreeStore, the host view, the callback sink. Reusable CMP library (android + desktop).
  • :androidbridge — a reusable Kotlin-only Android library (no Swift, no Compose) holding the JNI host glue: SwiftObject, NativeLibrary (now with a configurable library name), Runnable. Its classes stay in com.pureswift.swiftandroid for JNI symbol compatibility while the module namespace is com.pureswift.androidbridge.
  • :demo-app (Demo/app) depends on both; :demo-desktop (Demo/desktop) depends on :composeui.

Verification

  • swift test — 117 core tests pass under the renamed SwiftUICore.
  • Both :composeui and :androidbridge build as AARs; the demo app builds against them and runs on the emulator (catalog renders; logcat shows the extracted NativeLibrary loading the Swift .so, proving the full JNI chain through the split-out glue).
  • The macOS desktop rig builds and runs from the new root through SwiftUICore + ComposeUI (:demo-desktop:run), with the shared catalog rendering and a Button screen's tap counter incrementing — the full state loop.

Note

Task names changed: :app/:swiftui/:desktop:demo-app/:composeui + :androidbridge/:demo-desktop, and gradle now runs from the repo root. This PR also carries the earlier desktop code-sharing work (the rig reuses the Android demo's playground sources, Android-only screens gated out).

@colemancda
colemancda merged commit ffb0197 into master Jul 24, 2026
6 checks passed
@colemancda
colemancda deleted the feature/popover branch July 24, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant