Remix.run Logo
bsaul 14 hours ago

i tried building cross-platform libraries in swift for the past two years, with no success. I just did it in rust (ios / android / wasm) in a week, knowing nothing about the language.

the swift wasm project still uses a forked compiler IIRC…

frizlab 5 hours ago | parent [-]

> the swift wasm project still uses a forked compiler IIRC…

No <https://forums.swift.org/t/stdlib-and-runtime-tests-for-wasm...>.

Like I told you, I cross compile to all of the targets directly on my Mac (except windows that I do technically on my Mac, but on a VM). I could use Linux all the same.

Swift now has the concept of Swift SDK (`swift sdk install …`) and it is possible to target whatever (that has an SDK) easily. Yes, they took their sweet time, but it now works properly.

bsaul an hour ago | parent [-]

Interesting, thanks. Do you have a resource that shows basic examples for android & web ?

Rust also has a very extensive set of tools to generate bindings ( wasm bindgen & uniffi), and a wide ecosystem of crate for all platforms (rustsqlite, web_sys, reqwest, etc).

What's the experience like in swift for you ? What part of the swift libraries ecosystem can you use in practice, and how does bindings work ?

Let's say i want to expose an async call to a local sqlite instance on android. How would that work, and how would that look like from kotlin pov ?

Also, how is the size of the wasm packages ? how much cruft does swift need to embed ?

PS: reading the thread a bit more, it seems like you still need some special options, and some specific version of the toolchain. Is it still the case, or can i try it with the default toolchain distributed with xcode ?