Skip to content

build(apple): share iOS state bridges with macOS - #1

Merged
AritxOnly merged 1 commit into
DeadlinerStudio:byosfrom
Tequilaar:mac/apple-bridges
Nov 3, 2026
Merged

AritxOnly merged 1 commit into
DeadlinerStudio:byosfrom
Tequilaar:mac/apple-bridges

Conversation

@Tequilaar

Copy link
Copy Markdown

改动

把以下 4 个文件从 shared/src/iosMain/kotlin/com/deadliner/bridge/ 原样移到 shared/src/appleMain/kotlin/com/deadliner/bridge/(纯移动,0 行内容变化):

  • IosTaskListStateBridge.kt
  • IosHabitListStateBridge.kt
  • IosOverviewStateBridge.kt
  • IosFocusTimerStateBridge.kt

IosQuickAddBridge.kt 依赖 IosLifiCore(仅 iOS),保持在 iosMain 不动。

原因

macOS 原生客户端(SwiftUI)需要与 iOS 相同的方式把 ViewModel 的 StateFlow 交给 Swift。这 4 个桥接类只依赖 commonMain 的 ViewModel / Repository 与已有 macOS 实现的平台函数(例如 updateWidget 在 macosArm64Main 已有 actual),放到 appleMain 后 iOS 与 macOS 共用同一份实现,不需要在 macOS 侧复制。

不影响 iOS

  • 类名、包名、公开接口都不变。
  • 改动前后分别链接 iOS Simulator framework(-PlifiMode=stub :shared:linkDebugFrameworkIosSimulatorArm64),生成的 Shared.h 逐字节一致。

验证

  • ./gradlew -PlifiMode=stub :shared:macosArm64Test:274 个测试全部通过(Xcode 27.2、Zulu 21)。
  • macOS framework 中可见这 4 个类,已在 Mac 客户端中使用(任务列表、习惯列表)。

未包含(供参考)

  • 目前 macosArm64 目标没有声明 binaries.framework。Mac 客户端在构建时用 Gradle 初始化脚本补上了导出,没有改动 Core。如果以后希望 Core 直接产出 macOS framework(或加入 XCFramework),可以另开一个改动。

Move IosTaskListStateBridge, IosHabitListStateBridge, IosOverviewStateBridge
and IosFocusTimerStateBridge from iosMain to appleMain, unchanged, so the
macOS host can use them. Class names and the iOS framework header are
unchanged (verified byte-identical). IosQuickAddBridge stays iOS-only.

@AritxOnly AritxOnly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the unchanged Apple state bridges and source-set move.

Validation: combined PR #1–#4 checkout with both follow-up fixes; ./gradlew --offline -PlifiMode=stub :shared:macosArm64Test — 280 tests passed, 0 failures. Private Lifi mode and iOS framework linking were not rerun in this pass.

@AritxOnly
AritxOnly merged commit 010ba3e into DeadlinerStudio:byos Nov 3, 2026
1 of 2 checks passed
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.

2 participants