Rename to SwiftUICore/ComposeUI and extract reusable Kotlin libraries#68
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
AndroidSwiftUICore→SwiftUICore— the platform-neutral evaluation core (View/State/evaluator/RenderNode IR). No Android imports; builds and tests on any host.AndroidSwiftUIBridge→ComposeUI— the JNI materializer/bridge to the Compose interpreter. Platform-neutral (desktop JVM + Android).AndroidSwiftUInow@_exported imports bothSwiftUICoreandComposeUI, 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 thancanImport(SwiftUICore)— Apple ships a privateSwiftUICoreframework 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 (wasDemo/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 incom.pureswift.swiftandroidfor JNI symbol compatibility while the module namespace iscom.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 renamedSwiftUICore.:composeuiand:androidbridgebuild as AARs; the demo app builds against them and runs on the emulator (catalog renders; logcat shows the extractedNativeLibraryloading the Swift.so, proving the full JNI chain through the split-out glue).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).