Hacker News new | past | comments | ask | show | jobs | submit login

That is probably the opposite of true. Go read the forums once in a while, the foundations are really well thought. I agree that function builders were probably added for the shiny SwiftUI (and was added too soon), as well as the property wrappers, but apart from that, the process of adding features in the language is actually quite transparent and well-defined.

Also Swift now has real cross-platform support. All of the libraries I create I test on macOS, Linux, Windows, android and WASM/WASI.






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…


> 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.


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 ?


> Let's say i want to expose an async call to a local sqlite instance on android.

I don’t know, I don’t do android dev. I just made sure my library was running on it then moved on. I know Swift is working on having bidirectional interoperability with Java[1], so I guess when they do it’ll just work? But I did not dig more on the subject.

Regarding the size I’m not sure as I never compiled a binary that is actually useful. I make sure everything runs, but as I’m building a library this goes to building the tests then running them on WASI and that’s it.

Regarding the Swift toolchain version, using swiftly[2] is recommended nowadays if you don’t need Xcode. Using the default toolchain provided by Xcode usually brings trouble when using SDKs. Using swiftly you’ll get the same experience as on Linux basically. (This will probably change, but it is like so currently.)

[1] https://github.com/swiftlang/swift-java

[2] https://www.swift.org/install/macos/#:~:text=Swiftly




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: