To be clear, I don't hate Swift at all, I like some bits of it, it's just that there's no real draw for me to play with out side of the Apple eco system. If Apple made it so that I could use it write Android apps with it (kinda like Dart is supposed to be), I would be much more excited about. If Swift was dedicated to a small set of unifying principles (kinda like Elixir), I could get more excited about it.
[1]: https://blog.jetbrains.com/kotlin/2012/02/kotlin-goes-open-s...
[2]: https://developer.apple.com/swift/blog/?id=34
[3]: https://github.com/JetBrains/kotlin/commit/369b1974782b821e4...
[4]: https://github.com/apple/swift/commit/afc81c1855bf711315b8e5...
Kotlin may have been around longer, but it did not enjoy the early momentum and energy that was granted because of Apple's energetic adoption and marketing. JetBrains didn't have the early resources to dump into Kotlin at first like Apple gave to Swift. In fact, I would posit, that if Swift had not gotten a giant kick off from Apple, Google may have never felt so compelled to support Kotlin like they did. They may have been fine "just do it with Java, or you can use JetBrains stuff if you want" indifferent attitude that existed for much of the early life of Kotlin.
Both languages want to remain objecty. But have added "systems" features. And are more functional. And more asyncish. And more actorish. More saftey-ish. So on and so forth.
Swift came out of the iOS side of the company, and was sponsored to make writing iOS apps easier. It was therefore constrained to fit into a particular shape; in particular, Objective-C compatibility was a must have. Many of the frameworks and libraries on iOS/macOS are implemented in Objective-C including “std” libraries like Foundation.
When building Swift for Linux/Windows, there isn’t an Objective-C ecosystem, and rather than introduce one, instead the language just doesn’t have support for that. As a result, the “std” libraries are a complete rewrite of the libraries available on macOS. Even being able to include Posix basics used a different library name; Darwin vs GlibC. [There was a long battle to try and get a meta import of LibC which would import the right one on different platforms.]
So there are really two dialects of the language: Apple Swift and Linux/Windows Swift. They share the same overall feel but is like the difference between Diesel and Petrol/Gas. Same overall outcome, different completely under the hood.
Two other reasons exist; firstly, the internal builds are a fork of the open source project, so when a new feature lands on an iOS device, code and libraries are written to support that (eg SwiftUI) and nothing related to that fork lands until after Apple have announced it. What that means is you get giant blobs of diffs on an annual basis; in some cases, reverting bugs that have been fixed already in the open source world (because the internal version was forked six months previously).
The other reason is that Swift depends on a forked version of llvm/clang, to the extent where you have to install those to be able to compile Swift programs. Many upstream distributions already ship their own clang, which is essentially incompatible with Swift, but they want to follow their philosophy of only one version of a library (and don’t want to replace their own version with a Swift specific one).
So, Swift on iOS is a primary platform, and if you are writing iOS apps is the standard way. Every other platform is a second class citizen and software project management at Apple is not well suited to an open source workflow; since the iOS team are calling the shots on swift (and paying for most of it, to be fair) then the language evolves for their benefit primarily and then others as a side effect.
But the Linux story was garbage through v5, with half the standard library being unimplemented, and you getting to find out only at runtime.
Also, swift on Linux was (is) still just “here’s a tarball, dump it somewhere” or build from source.
That and the fact that static binaries aren’t a thing without a lot of work, if at all, means you have to ship a 2gb runtime to do anything — which sucks for casual tools.
I love the language but it feels like a bad time anywhere but on Darwin
From an outsider's perspective, Swift is an attempt to replace ObjC as the "macOS/iOS platform language" with something that feels a bit more '21st century' (for better or worse), so it plays the same role as Kotlin on the Android platform.
IMHO a better solution would have been to provide more "language-interop-friendly" C-API wrappers for high level macOS framework APIs, so that it's easier to write macOS and iOS applications in all sorts of languages (the same applies to Android btw). But the NIH seems to be strong at Apple, so Swift it was instead.
> IMHO a better solution would have been to provide more "language-interop-friendly" C-API wrappers for high level macOS framework APIs, so that it's easier to write macOS and iOS applications in all sorts of languages
that was arguably easier with obj-c already, and had java, then ruby and python [1] lnguage interops but alas were not popular...[1] https://developer.apple.com/library/archive/documentation/Co...
Swift is also the bulk of what I write for my day job, and it's always nice to not have to allocate mental resources to the differences between languages when trying to work on personal projects in one's off-time. It's so nice to just sit down and just start writing code without having to spend a ton of time googling "how to do X in Y language".
And when you take the family Swift is in, (now also with Kotlin), i consider it the best language over its peers not only given the design, but the fact that being AOT compiled from the start it's of great value.
Having said that, i feel inclined to invert the question as, why i would not want to use and learn it?
In my experience at least, a lot of IT folks, just don't have the mental energy for the likes of C++ and Rust, but can peak at a language like Java which can already be complex enough.
For instance, i deal mostly with C++ all day, and i don't think i would choose it if i were to create an application with buttons, multi-media, etc.. Nor Rust(same problem as C++) or Go(poor design for that goal). Given there's a language like Swift which combines the design and speed/efficiency to create such a thing.
If i were to create a backend service for instance, i would take Go into consideration, and probably in that case it would be a better fit than Swift or Rust or C++..
So its about being the right tool for the job.
Of course, if you want to catch-up with the average speed of C++ you will need some effort, but knowing that it will be pretty fast without much effort and without all the other penalties is reassuring.
I wonder if this late open sourcing contributed to this.
And yes, from the outside, it seems very Apple oriented. For any use case outside Apple there seems to be a (more?) suitable language.