It’s 11-years old and I don’t see it talked about much on HN (except for discussion on Apple libraries & bugs).
Do people like it as a language, and why?
It’s 11-years old and I don’t see it talked about much on HN (except for discussion on Apple libraries & bugs).
Do people like it as a language, and why?
It's the only language I've used where I have never asked "but why?". Every language feature and stdlib API just does what it says and acts in the way that makes the most sense. You're basically forced to handle every case (null, any type of error, switch cases, etc). It's highly dynamic, yet code tends to stay understandable. Apple is thoughtful about naming things and designing APIs. It's the only language I almost never need to write utility functions for - generally the type you're operating on has a method to do what you want, which you can easily discover with auto completion. Strings are sequences of graphemes, not code units or code points, and their API reflects this.
It's not perfect, but nothing else comes as close. One of the most prominent complaints - compile time explosion - really only happens in contrived examples where you're using a bunch of literals in one expression, which isn't realistic.
However, it's stuck in a single ecosystem. And let's not talk about some of the newer frameworks. Oh, and Xcode is a joke.
"Why are tuple not Hashable ?!"
Which means that you cannot have a tuple of Int `(1, 1)` as a key in a dict, and you have to make a struct that implement Hashable instead.
And
"Why do they not have a `.sum()` and I have to do `.reduce(0, +)` every time instead."
Or implement it yourself
extension Sequence where Element: AdditiveArithmetic {
func sum() -> Element { reduce(.zero, +) }
}And it is usually a pretty basic iterator standard to have it so that someone maybe not as familiar with concepts like reduce can just sum the sequence.
Or if someone not familiar with reduce read your code, and is like "what is that `.reduce(0, +)` thing everywhere!?" while instead it should be a no brainer `.sum()` <-- "yup make sense"
The compile time issues I have mainly come from TCA, but I still see them from time to time in normal code.
I have a few other syntax gripes, but largely see it as competitive with Typescript and Rust in terms of how nice it is to use. TS and Rust blow it out of the water with tooling, though.
TS to me is just an awkward patch on top of JS. It's really great! But only compared to JS. The mental model of its type system is difficult to form completely.
But yes, Swift's tooling doesn't compare.
I know you should have defined validators for every single external API, library and database, but at some level it feels silly to do all of this extra work.
In new projects, I've found that it's now very rare to come across a library that doesn't provide typings, or violates the interface.
As a side note, for some reason people like to bitch Xcode just out of habit perhaps. It's a kind of base line statement. Not my experience either. It's an excellent IDE for the current year of 2025. Helps me a lot and I build end-user facing apps, the proof is the love that users give to my apps. In other words, I have skin in the game.
I've used a lot of IDEs, and spend plenty of time using XCode. It's the worst I've used by far, and the only one where I feel it necessary to edit the majority of code in a separate editor.
Writing apps that people love makes you a good developer, but says little about the tools you use.
By the way, I am impressed by speed of Swift 6 project builds on Apple Silicon Macs. My non-trivial apps using a mix of Swift/C++/C files (hundreds and hundreds) get compiled in nearly real time. Feels good.
> ...give it some room to breathe by adding a clarifying type definition
Right, but that's the problem - it's the only language I've used where this is something you have to worry about, and it's not like the type system is more powerful. And often, the issues stem from external libraries outside my control. Better compiler errors would help mitigate the issue.
There's a lot to like about Swift, but I also think it's productive to identify the parts that compare unfavorably to other languages.
Yesterday I changed the signature of a method, and instead of complaining at the callsites I got a ”ambiguous method” error for a built in SwiftUI view modifier. Kinda hard to track down if you’re not completely aware of the changes you’ve made
* But why I cannot use @Published and other decorators in protocol declarations?
* But why must generics always be a pain in the ass, compared to .net, even in the most recent versions? 5 ways to do things, never the one you need
* But why is the person that designed the if case let value = .variable syntax not flagellated in a public square?
* But why is modern concurrency and SPM so undocumented?
Swift offers convincing ease for writing abstractions that underpin the app layer. You can be as clever or as simple as you wish, it's up to you. I prefer to keep it simple.
The other huge win for me is its ability to combine multiple language codebases at the SOURCE CODE LEVEL under a single project umbrella. Many of my projects use a mix of:
- Swift
- C++
- C
The whole thing gets compiled from a bunch of source code folders with a single command. No wrappers or binary wrangling, simply call C++/C from Swift.Compile time is really fast for me with Swift 6 onwards.
I use Xcode (and I am fine with it, it compiles really fast in year 2025) or VSCode (with Swift plugin) — both achieve the same thing in my experience.
Want to build a Docker Linux container? Very simple too. I fine tune and debug the project on dev macOS machine then use a Docker Linux container to build it for Linux (on a Mac or Linux) and deploy the binary. It's a single binary file by default, all libs inside. Then copy it to my NAS or deploy to remote Linux server and enjoy the speed.
Low friction, easy abstraction, fast delivery and binary machine code executable. That's what speaks to me.
I, personally, don't like it and I prefer Objective C. But I'm not professional iOS developer, so take my words with grain of salt.
[1] https://github.com/xcode-actions/swift-sh
PS: Yes, it’s a fork, but at the point I’m at there is nothing left from the original implementation. Even the way the program works is different.
It's not fool-proof either. Microsoft started the .NET Foundation, but that hasn't stopped them from causing drama by pushing self-serving decisions from the top-down. I don't really fear the same sort of behavior from Apple very much, but I definitely worry that Apple might eventually lose interest on the cross platform part for sure.
This is especially troubling because it is a fairly innovative language. If you get trapped on an unmaintained port of it, moving off of it seems like it might be hard. It's got a lot of clever ideas I haven't seen elsewhere.
I'm not sure how much of the standard library is available on the server side. However, I it's more about the engineers' interest than it is Apple's, and in that respect, the Swift ecosystem has been evolving constantly, e.g., the Swift toolchain was entirely divested from Xcode a month ago.
I can't speak for the .NET ecosystem, but your fears are unfounded. Whether Swift is useful in a cross-platform context is another question, however.
As for server side, the standard library is entirely available on other platforms, with a subset available for embedded Swift. However, it's fairly limited when compared to something like Python, and cross platform support for the other libraries like swift-foundation or SwiftNIO is more limited (IIRC SwiftNIO still doesn't support Windows properly).
I'm not sure what you're talking about with the tool chain. Apple has been producing toolchains that can run on macOS outside Xcode for years. Do you mean integration of swiftly? I think that just brought swiftly support to macOS for the first time.
Ultimately I agree with jchw; Swift would be in a much better position if it wasn't controlled by Apple's process. Features could get more than a few months work at a time. We could have dedicated teams for maintenance intensive parts of the compiler, like the type checker or the diagnostics engine, rather than a single person, or a few people that switch between focus areas.
Secondly, I don't really feel like this sort of analysis does much to assuage fears, as Apple's business strategy is always going to take priority over what its engineers individually want. Apple of today doesn't have any obvious reason to just go and axe cross-platform Swift, but if that ever changes in the future, they could do it overnight, like it was never there. Could do it tomorrow. It's not much different than an employee getting laid off abruptly.
This is especially true because in truth Apple doesn't really have a strong incentive in the grand scheme of things to support Swift on non-Apple platforms. Even if they use it in this way today, it's certainly not core to their business, and it costs them to maintain, costs that they may eventually decide benefits their competitors more than it helps them.
There's no exact heuristic here, either. Go is entirely controlled by Google and does just fine, though it has the advantage of no conflict-of-interest regarding platforms. Nobody writing Go on Linux servers really has much reason to be concerned about its future; Partly because Google has quite a lot of Go running on Linux today, and given how long it took them to e.g. transition to Python 3 internally, I can just about guarantee you that if Go died it would probably not be abrupt. Even if it was, because of the massive amount of external stakeholders there are, it would quickly be picked up by some of the large orgs that have adopted it, like Uber or Digital Ocean. The risk analysis with Go is solid: Google has no particular conflict of interest here, as they don't control the platforms that Go is primarily used on; Google has business reasons to not abruptly discontinue it and especially not on Linux servers; there are multiple massive stakeholders with a lot of skin in the game who could pick up the pieces if they called it quits.
I believe Apple could also get to that point with Swift, but they might need a different route to get there, as Swift is still largely seen as "That Apple Thing" for now, by a lot of outsiders, and that's why I think they need to cede some control. Even if they did fund a Swift foundation, they could still remain substantially in control of the language; but at least having other stakeholders with skin in the game having a seat at the table would do a lot to assuage fears about Swift's future and decouple aspects of governance from Apple in ways that would probably ultimately benefit Swift for everyone.
P.S.: And I'm not singling Apple out here, because I think any rational company has to make tough decisions sometimes, but it's obvious from their past that they definitely don't fear changes of plan. Look all the way back to OpenDoc. Being willing to make bold changes of plan feels like it's a part of their company DNA.
You would think that being constrained by one company would ensure the project remains lean, but apple actually had the opposite effect. Instead of focusing on real cross-platform support, or strong language foundations, they kept piling on features that nobody asked but made nice developer conference demos.
Also Swift now has real cross-platform support. All of the libraries I create I test on macOS, Linux, Windows, android and WASM/WASI.
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.
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 ?
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.)
I'm confused..
It has some challenges that it needs to solve to do great as a cross platform "general-purpose" programming language.
It's paradoxically high level with its syntax and ergonomics but is tied down to the same cross platform headaches like in low level languages (e.g. cpp). Linking across cross platforms requires lots of careful thought and testing. Unlike cpp, it's not super portable. It requires a hefty 30 MB runtime for some features of the language to work. Try static executable hello world.
That being said, it's possible. You can build cross platform applications with Swift, but you'd still have some of the same kinds of portability issues like in cpp but with nicer syntax and ergonomics.
It stands with .NET on Windows, or Kotlin on Android, however outside Apple is at tooling level of .NET Core early days, think .NET Core 2.0.
Mostly usable for Apple shops that need to deploy into Linux servers for their app backends, and share code.