1.6 KiB
1.6 KiB
title, created, updated, type, namespace, tags, related
| title | created | updated | type | namespace | tags | related | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Reflect — Skip Fuse (SwiftUI/Kotlin) | 2026-05-23 | 2026-05-28 | tech | personal |
|
kraken-network |
Reflect — Skip Fuse (SwiftUI/Kotlin)
Key Pitfall
When adding a new SwiftUI View to the Reflect iOS codebase, Skip Fuse does not auto-generate the Kotlin counterpart. A manual Kotlin stub is required in 2 places:
- The View class file in the Android module
- The registration/factory in the Android navigation/router
Why
Skip Fuse transpiles shared SwiftUI code to Kotlin, but new View types require explicit Kotlin stubs until Skip's transpilation coverage catches up.
Checklist for New SwiftUI Views
- Add SwiftUI view as normal in iOS target
- Create matching Kotlin stub in
android/src/.../views/ - Register in Android router/factory
- Run
./gradlew buildto verify no missing class errors
#if SKIP vs #if SKIP_BRIDGE — Definitive Rule
| Macro | When to use |
|---|---|
#if SKIP |
Any code that runs only on Android via Skip (UI layout, Android-only APIs, SAF file access). Works in all Skip-compiled code. |
#if SKIP_BRIDGE |
Only for JNI bridge calls: AnyDynamicObject, calling Kotlin statics from Swift, import SkipBridge. Available only in bridge modules. |
Rule: UI buttons, conditional layouts, Android-only views → #if SKIP.
AnyDynamicObject(forStaticsOfClassName:) and JNI → #if SKIP_BRIDGE.
Using #if SKIP_BRIDGE for UI will silently exclude the code on Android (it's not a bridge module), causing buttons/views to disappear with no error.