Ask HN: Anyone using Swift on the server-side?

58 points by _448 ↗ HN
For web development or otherwise.

What are the challenges and advantages?

12 comments

[ 2.4 ms ] story [ 41.2 ms ] thread
The team over at Swift Cloud are making it run on the edge.

https://swift.cloud/

That looks nice. I wrote a Swift book last year and I had originally intended on including a server side example but didn’t get to it. Hopefully I will add an example in the next edition.

I have preferred Lisp languages for the last 40 years, but there is something about Swift I like, probably the availability of great libraries like CoreML and good REPL support.

For Lambda, AWS EC2, and ETL job using TabularData framework.

Highly performant, It runs within docker container. Documentation is highly available.

Challenges: Getting more people to use it and collaborate with it.

SwiftUI has become more trendy, that other frameworks don't get wide relevance.

another library which brings more interesting projects is: CoreML On-Device ML training and inference

CoreML is such a bad lib compared to Pytorch/Jax and even Tensorflow that im not sure why anyone should use it if they can just use other stuff (i would probably prefer pure MPSGraph for training on device at it allows me to control everything in easy and Tensorflow like way)
Pre-pandemic I was building a new EV charging kiosk experience on Raspberry Pi industrial hardware using Swift in Docker (actually, Balena). Build times were a little long at the time, due to the RPi CPU speed and Swift’s compiler. But there were a surprising amount of hardware drivers available for things.

Also key were these Docker images: https://github.com/wlisac/swift-on-balena

I wrote a little service to handle some of the Matrix client-server authentication API.

The first version used Vapor before we had async/await. That was painful at times but doable.

Earlier this year I got some time to rewrite it in modern Swift with async/await. It’s a total game changer. Almost as easy as writing in Python.

Maybe even easier than Python sometimes, because with Swift you have a decent type system watching your back. If it compiles, then you’re probably most of the way there.

We use Vapor3 and the language is ok, but the deployment story (docker/k8s, for us) is a nightmare and has caused us unending drama. Things seem a little better with newer versions of vapor and swift 5.5, but our experiments don’t seem to have gotten very far, and the upgrade story is quite a lot of work.
Curious about your experience with k8s, what has caused issues? (Genuinely curious, I've played with the idea of writing my own.)