Live data from Hacker News

Ask HN: What is the future of Swift on the server-side?

news.ycombinator.com

11–20 of 60 posts

Re: Ask HN: What is the future of Swift on the server-side?

#11
post #7

I have a production app live using Swift/Vapor. I created this app solely for the purpose of learning full-stack development using Swift, and so far it has been an amazing ride. The best thing about using Swift on the server if you're already an iOS developer is that a ton of models and DTOs are simply shared across your backend and your app(s). I have deployed my backend on a tiny DO droplet using Docker, and it jus…

We step down from Heroku as well and looking for alternatives. Can you share your Docker somewhere?

Re: Ask HN: What is the future of Swift on the server-side?

#14

> backend for my project > a performant, statically-typed, systems programming language. What is your project about? What are the latency requirements? How many concurrent users you expect to have? If these numbers are not high, why are you not using a general purpose language like go or Kotlin? I used vapor for a evaluation project a while ago and abandoned it quickly. While Swift is a nice language, it is still a 2…

> While Swift is a nice language, it is still a 2nd class citizen on non-Mac systems.

What makes it a second class citizen?

Re: Ask HN: What is the future of Swift on the server-side?

#15
Swift's performance is a mixed bag, and can be closer to JavaScript than C++. It heavily depends on how you manage your objects and how many memory allocations and copies that causes. Swift prioritizes nice syntax over implicit overheads, so it's something to look out for.

If you really really need something high-performance, then Rust is the main contender. Don't be fooled by superficially similar angle brackets syntax. It's not similar to C++, it's is not even a C-family language (closer to ML). Things like having multiple string types may seem like the same mess, but it's not a legacy baggage like in C++, but an explicit meaningful choice exposing ownership and encoding semantics.

If you merely need pretty good performance, go for golang. It's very successful for services.

I don't see room for Swift in server-side languages. It won't be able to shake being Apple's technology first, and having Linux support as a second class. It's not low-level enough to beat Rust on performance. It can't compete with popularity and ease of use of JS/TS and golang.

Re: Ask HN: What is the future of Swift on the server-side?

#16

> backend for my project > a performant, statically-typed, systems programming language. What is your project about? What are the latency requirements? How many concurrent users you expect to have? If these numbers are not high, why are you not using a general purpose language like go or Kotlin? I used vapor for a evaluation project a while ago and abandoned it quickly. While Swift is a nice language, it is still a 2…

> While Swift is a nice language, it is still a 2nd class citizen on non-Mac systems. What makes it a second class citizen?

I’m a huge Swift advocate, even on the server, but I have to admit Swift for Linux feels like an afterthought sometimes. For instance there are still no official Debian-based Swift docker images, and the “stdlib” (the Foundation module) is very often behind the (private) macOS’ one (still no support for async/await, lots of bugs that take time to be resolved, etc.)

Things do get better with time and developing for the server with Swift is a great experience, but it still feels a bit early.

Re: Ask HN: What is the future of Swift on the server-side?

#17
I've used Swift for iOS development and generally like it. There's no technical reason why it couldn't be great for server-side development but there are two major reasons I wouldn't expect it. First, there's no painful gap to drive adoption. Go and bit by bit Rust are both reasonable statically typed, compiled languages with good ergonomics and performance. Second, there isn't a strong community of corporate and individual developers supporting use outside of iOS. That means few people, but also little tooling. I was excited by the extensibility and some of the stuff the TensorFlow team was doing but there just doesn't seem to be enough reason to pick Swift over one of the more mature alternatives. Even on Apple's own platforms there's only full support for the latest macOS release. I'm guessing the calculation is that iOS is a big enough carrot to keep a community of Swift developers around and Apple doesn't see growing beyond that as a priority. Fair enough.

Re: Ask HN: What is the future of Swift on the server-side?

#18
Its future is the same as its present: niche server-side choice only used by Apple-adjacent developers.

Such a squandered opportunity on Apple's part. In the early years, the Swift team talked a big game about wide industry adoption goals, but multiplatform seems to just be a defeated box-ticking exercise now.

People say Apple are an unstoppable marketing machine, but they did an absolutely horrific job of engaging the wider software development community with Swift.

Re: Ask HN: What is the future of Swift on the server-side?

#19

> backend for my project > a performant, statically-typed, systems programming language. What is your project about? What are the latency requirements? How many concurrent users you expect to have? If these numbers are not high, why are you not using a general purpose language like go or Kotlin? I used vapor for a evaluation project a while ago and abandoned it quickly. While Swift is a nice language, it is still a 2…

> While Swift is a nice language, it is still a 2nd class citizen on non-Mac systems. What makes it a second class citizen?

The complete lack of any explicit support from linux vendors and cloud providers.

For more popular languages you get predefined templates for serverless platforms and compiled binaries directly in the linux distributions default repositories.

In many ways the outside interest in swift died down even quicker then the interest in running ObjectiveC outside of the Apple Ecosystem did, and as the Apple ecosystem don't include an server platform all swift server-side code is running outside of the apple ecosystem.

The problem likely isn't that swift is bad just that it's unremarkable once you take it outside of an iOS context.

Re: Ask HN: What is the future of Swift on the server-side?

#20
Non-existent unfortunately. Swift hasn't taken off outside of the Apple ecosystem, which is of course heavily client focussed. If you like the look of Swift, but you're writing backend code then I would definitely recommend Rust. It's actually super nice to work with. Not at all like C++.

Other alternatives would be Kotlin, C#, Go, or even Java.

Post reply on HN