bioche
(Eric Blachère)
1
Hello Swift Community !
I have recently explored how to share code between fully native iOS and Android apps (Swift & Kotlin) and I'm currently evaluating if WebAssembly that would reuse our swift code would be a viable solution. The ultimate goal (dream ?) would be to have a single swiftWasm code-base that would consist of our current swift code and call to native APIs on iOS & Android to have access to Bluetooth, Geolocation etc...
For now I see 2 main issues :
-
For me the most problematic thing would be the UI. Currently almost all of our screens are made in SwiftUI. I think we all agree SwiftUI should have been open source from the start & decoupled from UIKit/AppKit but sadly it isn't. Is there a stable, production ready UI lib out there that can take SwiftUI code and render it properly in WebAssembly ?
-
There is also the issue of integration & interoperability with Apple / Android APIs or other parts of app that would still be native for example for BLE connection. We can integrate .wasm in WKWebview but how can we interact both ways between iOS/Android and Wasm code ?
Keep in mind I've a solid experience with Swift but I'm completely new to WebAssembly so I may be missing something obvious here ^^
If anyone has already attempted something like this, feel free to share ;)
Thank you
1 Like
bioche
(Eric Blachère)
3
Thanks that's encouraging to see people working on Swift for Android ! Seeing Compose multi-platform in alpha makes me think we should work to have something similar done in Swift thus my question about the UI side of things for wasm or any platform really ^^
bioche
(Eric Blachère)
4
Any other insight on which UI framework to use with SwiftWasm ? Is Tokamak still the official solution ? Is it still maintained ?
On the UI side, this thread on the Mobile Native Foundation discussion indicates that quite a few teams have invested in Server Driven UI based appraoches over the years.
Personally I think there would be a lot of interest in an open source set of tools for creating, downloading and verifying signed wasm binaries on iOS & Android, that could compliment either SDUI, KMM or a hypothetical swift cross platform UI system. Maybe built on top of GitHub - wasm-signatures/wasmsign2: Implementation of the WebAssembly Modules Signatures.?
Ideally this would be composable so that teams can choose their own WASM interpreter such as wasm3, WasmKit, etc.