Hiya Skip (Split Mixed)
This is a Skip dual-platform sample app: from a single Swift
and SwiftUI codebase it builds a native app for both iOS and Android. HiyaSkip
demonstrates a mixed-mode app that connects a natively-compiled Swift model
to a transpiled SwiftUI user interface. It contains three modules:
HiyaSkip— the SwiftUI app, transpiled to Jetpack Compose on Android (Skip Lite).HiyaSkipModel— an@Observablemodel layer, compiled natively for both platforms (Skip Fuse). It is used directly on iOS, and on Android it is bridged to the transpiled UI via SkipFuse and SkipBridge.HiyaSkipLogic— a pure-Swift, cross-platform module (no bridging) thatHiyaSkipModeldepends on.
See the native Swift on Android documentation for more on natively-compiled modules.
It is one of four Skip sample apps that share the same conventional Skip app project layout but differ in their module structure and Skip mode, as shown below.
The sample apps
Section titled “The sample apps”| Sample | Modules | Skip mode |
|---|---|---|
| skipapp-hello | HelloSkip | fully transpiled — Skip Lite |
| skipapp-howdy | HowdySkip | fully native — Skip Fuse |
| skipapp-ahoy | AhoySkipper, SkipperModel | fully native — Skip Fuse |
| skipapp-hiya | HiyaSkip, HiyaSkipModel, HiyaSkipLogic | mixed — native model bridged to a transpiled UI |
In transpiled (“Skip Lite”) modules, Swift is converted to Kotlin and
SwiftUI to Jetpack Compose. In native (“Skip Fuse”) modules, Swift is
compiled directly for Android with the Swift toolchain and bridged to
Kotlin/Jetpack Compose; see Native and Transpiled Modes
for the distinction. skipapp-hello, skipapp-ahoy, and skipapp-hiya include
unit tests that run on both platforms; skipapp-howdy omits them.
Re-creating this project
Section titled “Re-creating this project”This repository is exactly what skip init produces — its CI verifies that it
stays identical to the generated template — so it can be re-created with:
skip init --no-build --native-model --module-tests --appid=hiya.skip --version 1.0.0 skipapp-hiya HiyaSkip HiyaSkipModel HiyaSkipLogicBuilding
Section titled “Building”This project is both a stand-alone Swift Package Manager package and an Xcode project that builds the iOS app and, using the skipstone plugin, generates and builds the equivalent Kotlin Gradle project for Android.
Testing
Section titled “Testing”The app can be tested with the standard swift test command, or by running the
test target for the macOS destination in Xcode, which runs the Swift tests as
well as the transpiled Kotlin JUnit tests in the Robolectric Android simulation
environment. Parity testing can be performed with skip test, which outputs a
table comparing the test results on both platforms.
Running
Section titled “Running”Xcode and Android Studio must both be installed to run the app in the iOS simulator and the Android emulator. Start an Android emulator first (for example, from Android Studio’s Device Manager).
Open Project.xcworkspace in Xcode and run the “HiyaSkip App” scheme. A build
phase runs the “Launch Android APK” script, which deploys the app to a running
Android emulator or connected device alongside the iOS build. iOS logs appear in
the Xcode console; Android logs appear in Android Studio’s Logcat tab (or via
adb logcat).
Contributing
Section titled “Contributing”We welcome contributions to this package in the form of enhancements and bug fixes.
The general flow for contributing to this and any other Skip package is:
- Fork this repository and enable actions from the “Actions” tab
- Check out your fork locally
- When developing alongside a Skip app, add the package to a shared workspace to see your changes incorporated in the app
- Push your changes to your fork and ensure the CI checks all pass in the Actions tab
- Add your name to the Skip Contributor Agreement ↗
- Open a Pull Request from your fork with a description of your changes