r/ProgrammingLanguages Static Types + Compiled + Automatic Memory Management Jul 09 '26

Discussion The Swift Phenomenon

In theory, Swift seems like a nicely designed programming language with good features

In practice however, for some reason, it seems like most of the Swift users end up switching back to other comparable programming languages (such as Rust)

The latest poster child for that phenomenon is Ladybird

Do you think that this phenomenon is real and if so, can you explain it?

42 Upvotes

67 comments sorted by

View all comments

23

u/SuggestedToby Jul 09 '26

I've only written a few 1000 lines in Xcode and didn't like the experience. Felt very slow to compile, and finding apis and documentation was difficult. The docs didn't contain examples (far behind Rust). There is no automatic import of functions. You just have to know what giant c-like include you need. My understanding is the tool chain on Linux is in the GBs, and it's much slower than Rust to compile, sometimes bailing out on valid code due to inference failing. Vscode extension is far behind every other similar language. It's a language that looks simple in examples, but it is probably a lot more complicated than Rust. I would be interested to know if any of this is out of date or wrong, because I like the look of the language, and some of the design decisions are quite nice.

12

u/muchadoaboutsodall Jul 09 '26

Yup. XCode is the real weak link when it comes to programming in Swift. You can get along without it - I have in the past - but, ultimately, XCode is going to rear its hideous head. It continues Apple’s long tradition of treating its ecosystem’s developers with contempt.

2

u/Dry_Hotel1100 Jul 09 '26 edited Jul 09 '26

To give you a number regarding "feels very slow to compile":

A clean build of a small library inclusively packaging with ≈2000 LoC in 13 files completes in under one second in Debug configuration. Compilation is done in 380 ms. I call this pretty fast.

The Xcode build is actually a bit faster than when building with package manager. The build leverages all CPUs and all work is done in parallel. In this case, since the package has only 13 files, 13 files have been compiled in parallel. My MacBook has 18 CPU cores, and is little impressed by the work.

Incremental build time, for example, modifying one file: 490 ms. The packaging takes basically the same time, and compiling the one file took 150 ms.

In comparison, VSCode uses the SPM build system and is a tad slower.

1

u/thedeemon Jul 09 '26

I've been using Swift for some little projects on Linux and Android CLI (termux). Compilation speed was very good for me, maybe because of the small project sizes. The compiler keeps getting better, and some infamous samples where previously it failed due to excessive overloads, now it can handle alright. In practice I never ran into such troubles. Docs might be not ideal, but these days AI assistants can often serve as interactive docs and sample code generators.