Skip to content

feat: add dari-kmp, a KMP entry point backed by the Swift SDK on iOS - #304

Merged
easyhooon merged 6 commits into
mainfrom
feat/dari-kmp-poc
Nov 15, 2026
Merged

easyhooon merged 6 commits into
mainfrom
feat/dari-kmp-poc

Conversation

@easyhooon

@easyhooon easyhooon commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds dari-kmp, so a Kotlin Multiplatform app can record a WebView bridge kept in commonMain on Android and iOS (#13). Nothing is published here; it ships with the next full release.

  • dari-ios: DariObjC / DariObjCInterceptor, an @objc entry point over Dari / DariInterceptor. The Swift API is unchanged.
  • dari-kmp: DariKmp.createInterceptor(tag): DariInterceptor? in commonMain.
    • iOS reaches DariObjC at runtime through a cinterop .def with no headers and no linked library. dari_kmp_status() checks every selector first, so an SDK older than dari-kmp returns null and logs once instead of crashing.
    • Android calls Dari.createInterceptor, compiled against dari-noop only, so the app's dari / dari-noop choice decides what runs.
    • Publishing setup, ABI baseline, and kotlin.mpp.enableCInteropCommonization=true, which the shared iosMain metadata compile needs.
  • JVM target returns null, so Compose Multiplatform apps with a desktop target can keep the call in commonMain.
  • CI: kmp-core.yml runs the dari-kmp checks; ios-sdk.yml also runs when the .def changes. /release-scope and /release count dari-kmp as library.
  • sample-kmp + sample-kmp/run-on-simulator.sh. sample-ios only calls it under #if canImport(DariKmpSample), so its normal build doesn't change.
  • Docs: docs/kmp-swift-bridge(.ko).md (design, alternatives, Swift export outlook, official references). The site user guide is in docs: add the Kotlin Multiplatform guide for dari-kmp #305.

Merging this publishes nothing: dari-kmp reaches Maven and DariObjC reaches SPM only with /release. The site guide (#305) is what must wait for that release.

Verification

  • :dari-kmp:iosSimulatorArm64Test: without the Swift SDK linked, the factory returns null. SwiftSdkBindingTest runs the cinterop path against ObjC fakes registered at runtime: status 0/1/2, the tag reaching the factory, and every call forwarded with its arguments (fireAndForget boxing, isSuccess, order). Mutating the selector checks or the argument passing makes it fail.
  • :dari-kmp:testAndroidHostTest: with dari-noop, the factory returns null.
  • dari-ios swift test: 55 tests pass. The new DariObjCTests reads the .def and checks each selector exists, and checks that calls reach the store.
  • :dari-kmp:compileIosMainKotlinMetadata, checkLegacyAbi, checkDariApiParity, and a publish to the local compat repo. The Android POM depends only on dari-core and the stdlib.
  • iPhone Simulator (iOS 27.2), Debug and Staging: the sample's six calls are recorded correctly. Checked in the store, in the in-app inspector, and with the desktop's IosAppFinder client. DariObjC survives -dead_strip.

Not verified: a USB device (none connected), the desktop window itself, Android at runtime with dari, and autoCapture for WebKit calls made from Kotlin.

The iOS side looks DariObjC up at runtime, so dari-kmp never links the Swift SDK.
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@easyhooon easyhooon mentioned this pull request Nov 13, 2026
16 tasks
Checks every DariObjC selector up front, delegates to dari/dari-noop on Android,
adds publishing, tests, a Simulator script and the user guide.
@easyhooon easyhooon changed the title feat: dari-kmp PoC forwarding to the Swift SDK feat: add dari-kmp, a KMP entry point backed by the Swift SDK on iOS Nov 13, 2026
dari_kmp_status_of / dari_kmp_interceptor_of take class names so iosTest can
point them at runtime-registered fakes instead of the Swift SDK.
@easyhooon
easyhooon marked this pull request as ready for review November 15, 2026 12:04
@easyhooon
easyhooon merged commit 517d2e7 into main Nov 15, 2026
4 checks passed
@easyhooon
easyhooon deleted the feat/dari-kmp-poc branch November 15, 2026 12:04
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