What’s new in Swift 6.2

132 ingve 116 5/9/2025, 8:20:52 PM hackingwithswift.com ↗

Comments (116)

travisgriggs · 4h ago
Honest question. Not trying to troll. One of the pitches in the earlier days was “C/Objective-C OK, but you can’t write safe/next level code with it—-Swift will close that gap.”

N years later, it doesn’t feel like there has been a step change in Apple software quality; if anything Apple software feels less solid, and looks cool “look what I did” extension points. I mean, some of the tings you could do with runtime categories, and runtime prototypes were really cool. Now when I work on my 2 apps that originally happily port to Swift/UIKit, I’m just left confused with how to make things work. I’m happy when it finally works, and don’t ever try to improve the thing, it’s too much work.

There’s lots of different variables at play here; I’m not trying to stretch inference too much. Heck, it could have been that with adding Swift to the mix, the forces that have contributed to reduced quality in Apples stuff would be even worse.

I’m just frustrated. When I work in Elixir, I’m like this is cool. When I work in Kotlin, I don’t feel like “Apples got a language like this too, but it’s got that extra special zing that used to make stuff Apple touched cool.”

elcritch · 3h ago
I feel the same. Apple software quality certainly hasn’t increased. Years back I remember some apps crashing suddenly after updating MacOS. I checked the binary and saw they’d started adding Swift.

Half a decade later it seems like it should be better and Swift stuff should be stabilized. But nope, I’ve had more little glitches in both iOS and MacOS. It’s hard to say it’s due to Swift, and not management priorities. Still it feels partially related to Swift.

Swift’s goals are great, I like the syntax, but the language implementation seems to just special case everything rather than having coherent language design.

That and Swift de-emphasizes Obj-C message passing. I have a pet theory that message passing produces more robust GUI software that’s easier to adapt to complex needs.

cevn · 1h ago
I have a good bug right now. My wife bought a Macbook Air. I use High DPI and she does not. It is impossible to switch between users in this situation, one of the core functionalities of the computer is just broken. Makes me wonder if anyone at Apple uses these computers..
rcruzeiro · 3h ago
> Swift’s goals are great, I like the syntax, but the language implementation seems to just special case everything rather than having coherent language design.

This could not be furthest for the truth. The entire process of proposing a new language feature to getting it implemented and shipped is out in the open for everyone to participate/see.

https://github.com/swiftlang/swift-evolution

msie · 1h ago
Too many cooks!
ardit33 · 2h ago
It is not just the language but the frameworks. SwiftUI is a wreck, and still not mature even after 6-7+ years in 'production'. You still have to drop to UIKit to do advanced UI, and for what it is, SwiftUI is just not practical enough for cases that are not trivial. The trouble is that all new kids/engineer are learning it first, which means software wont get better. Apple need to improve it first, and I don't see advanced folks ditching UIKit anytime soon for advanced UI.
firecall · 17m ago
That’s a shame!

I haven’t used Swift UI in a couple of years, but I always thought the basics of it were excellent.

They got the declarative API foundations right I thought.

Shame it’s still flakey.

The preview used to crash constantly last time I used it.

LudwigNagasena · 2h ago
Seems like another case of the general trend in software development of easy things becoming easier and hard things becoming harder.
cosmic_cheese · 1h ago
As someone frequently flipping between Swift and Kotlin, while I don’t necessarily feel like Swift is massively superior, I often find myself thinking “why is this so quirky and pedantic” when writing Kotlin.

For example, I really really wish Kotlin would adopt Swift style if let/guard let statements. Kotlin smart casting doesn’t work just often enough to not be able to consistently rely on it and the foo?.let { } syntax is ugly.

Combined with the JVM warts of gradle and jankiness of code stripping and obfuscation, generally speaking if I could opt to use Swift in place of Kotlin for Android dev I would do so in a heartbeat.

jimbob45 · 24m ago
Surely developer productivity and maintainability have increased from the ObjC days, no? Swift criticisms aside, it certainly allows access to more ergonomic high-level coding patterns.
cosmic_cheese · 7m ago
A big one that I feel is under appreciated is how Swift has rooted out nearly all passing around of untyped data, untyped dictionaries, casting without checking, etc in Apple platform projects.

I don’t mind Objective-C when I’m the one writing it and can ensure that the code is responsibly written, but it wasn’t unusual to have to work on existing Obj-C codebases littered with untyped data, casts, etc some amount of which was inevitably erroneous and only seemed to work correctly. Chasing down the origin points of data, fixing a laundry list of method selectors, and adding in checks always sucked with the compiler doing little to give you a hand. With Swift, even in codebases with poor hygiene fixing things is easier since the compiler will yell when something’s wrong.

w10-1 · 6h ago
The article doesn’t give enough attention to the glacial but steady changes in the ownership model that will have great benefit in avoiding copies in value types, Swift’s strength and Achilles heel.

I have to say Paul Hudson has almost single-handedly taken over communicating the essentials of Swift to the world; he’s fantastically reliable, brief but enthusiastic, guiding people around the many pitfalls.

strongpigeon · 5h ago
Agreed about Paul Hudson. He also just seems like a genuinely nice guy. I was kind of shocked to receive an email from him out of the blue last weekend (well, from GitHub, but with his name in the "From" field). Turns out it was about a PR [0] to one of my packages where he fixed typos in the README.

[0] https://github.com/visfitness/reorderable/pull/2

hudsonator · 4h ago
As someone who has worked with him, no he is not a nice guy. He is the opposite of a nice guy.
strongpigeon · 3h ago
I’d love to believe you, but you’re not giving us much to go on with
dkga · 3h ago
The last sentence is exactly how I would describe Paul Hudson, as a HwS reader/user.
sedatk · 6h ago
Free-form identifiers are neat for test-case naming, but not for `HTTPStatus.`404``. I think having `HTTPStatus.Error404` was a bad idea to begin with. Just use semantic names like `HTTPStatus.NotFound` and you wouldn't have a problem in the first place. Now, a single character typo can easily make a 404, 403 and create a bug. It's less of a problem with semantic names.

If you want constrained numeric types in Swift, that's another problem to tackle. But `HTTPStatus.`404`` seems to be the least ideal way to go about it. It lets you do stuff like to declare `HttpStatus.`404`` with a value of 403 too.

hombre_fatal · 2h ago
You might mess up 403 vs 401 in this system, but then in the next system you're messing up Unauthorized vs Forbidden.

It's like when you see a poisonous snake and can't remember if "red touches yellow" is paired with "deadly fellow" or "friendly fellow".

sedatk · 1h ago
Messing up Unauthorized vs Forbidden is a semantic problem, but 403 vs 401 can be either semantic or syntactical. It’s not like you’d mispress a key and get Forbidden instead of Unauthorized.
monkeyelite · 1h ago
> case _401 or case error401.

I'm not seeing why it's worth a whole language feature to avoid prefixing strange identifiers.

sedatk · 1h ago
I don’t think it’s the sole reason, but I find that example odd for sure.
jshier · 3h ago
Yeah, the feature is mostly about test cases and macro generated code. The numeric property names are far less useful, as the good syntax requires tick marks: .`404`
DidYaWipe · 1h ago
Yeah, this feature seems wholly unnecessary and possibly dumb. The example given is ridiculous.

If you can't figure out what stripHTMLTagsFromString() does, you have way bigger problems than a lack of spaces.

monkeyelite · 1h ago
> InlineArray does not conform to either Sequence or Collection

Why not? Does this mean I need to make a struct which wraps InlineArray and implements Collection? Why didn't they do that?

EDIT: found the answer (I still have concerns):

> While we could conform to these protocols when the element is copyable, InlineArray is unlike Array in that there are no copy-on-write semantics; it is eagerly copied. Conforming to these protocols would potentially open doors to lots of implicit copies of the underlying InlineArray instance which could be problematic given the prevalence of generic collection algorithms and slicing behavior. To avoid this potential performance pitfall, we're explicitly not opting into conforming this type to Sequence or Collection.

adamwk · 1h ago
There’s a section in the proposal about this: https://github.com/swiftlang/swift-evolution/blob/main/propo...

Tl;dr: Sequence and Collection are incompatible with noncopyable types and conditionally conforming when elements are copyable would result in too many implicit copies. They’re working on protocols to cover noncopyable collections such as this, which will probably have a similar API shape.

saghm · 1h ago
Interesting; if I'm understanding correctly, it sounds like Swift doesn't have a standard lazy iteration API yet? I would have guessed that it did if asked before reading this, but it's good to hear that they're already working on it. Since I feel super spoiled by lazy iterators in Rust, I'm super curious if anyone has more Swift experience and could chime in on if there are other language features or APIs that might illuminate why there wasn't as much of a need for this earlier; my general perception of Swift as an outsider is that it tends to have pretty well-thought out decisions based on factors that I just happen not to know about personally (e.g. compatibility with other parts of the Apple software ecosystem or different priorities due to the domains Swift is often used in compared to the type of stuff I work on personally).
adamwk · 14m ago
There are lazy collections, but they’re not default.

Why the protocols are designed the way they are is until very recently all types were implicitly copyable, but most of the collection types like array and dictionary were copy on write; so the copies were cheap. I think in general, though, there are a lot of performance footguns in the design, mainly around when copies aren’t cheap. The future protocols will hopefully rectify these performance issues.

trevor-e · 6h ago
Lot of nice improvements here. I'm actually quite liking the async API after using it in a couple small apps and learning the fundamentals.

I really wish the entire Swift team would spend a quarter fixing bugs and improving the compiler speed, though. So many trivial SwiftUI cases trigger the "this is too complex for the compiler" errors which are so frustrating to fix.

catapps · 4h ago
I've been starting to use Swift again lately after like four years, and while the language is beautiful & the package management story is now a LOT better with SwiftPM, I found that none of it plays nicely with XCode, Simulator, or anything to do with iOS/macOS development -- its primary use-case!

I found myself awestruck that I *HAD* to use XCode or xcodebuild, and could not just run `swift build` and generate an iOS app.

In the end, I had to:

- compile the .app structure myself

- run codesign manually

- manage the simulator manually

- bundle xcAssets manually

- provide swift linker flags manually targeting the toolchain/sdk I needed

- manually copy an embedded.mobileprovision

It was a good learning experience, but what's the story here? Did Apple just give away Swift to the OSS community and then make no ongoing effort to integrate their platforms nicely into the non-xcode build tooling? Looking into https://github.com/stackotter/swift-bundler

marcellus23 · 7m ago
I'm confused. You said "none if it plays nicely with Xcode" but then you complain about what the experience is like when not using Xcode.
seankit · 4h ago
The Swift language team has recently open sourced swift-build, and the community's assumption is that it was done in order to eventually move everything away from xcodebuild to swift-build, which would let you build an app from swift packages and fully break from Xcode: https://github.com/swiftlang/swift-build
tough · 3h ago
yep can confirm swift build works, at least i was able to build a MacOS app and avoid Xcode at all costs thanks to it phew
DidYaWipe · 1h ago
"a new Observations struct that is created with a closure, and provides an AsyncSequence that emits new values whenever any any @Observable data changes"

Is this another asinine onChange()-style mechanism that actually means WILL change? In other words, it tells you BEFORE the value is set on the object, so you can't do jack squat with it much of the time.

That's the M.O. of onChange now, which is utterly brain-dead. Gee, I've been told that a value changed in this object, so let's recalculate some stuff. WHOOPS, nope, none of the other objects (or hell, even the affected object) can take action yet because they can't interrogate the object for its new contents.

Truly incredible that they not only defaulted, but LIMITED change-detection to WILL-change, the least useful of the two choices.

amichail · 7h ago
Do you try to put everything on the main actor to dramatically reduce your debugging time?
klabb3 · 3h ago
I can’t speak to swift, but in experience with many other langs and runtimes I will say that single-threaded business logic by default is still the only sane choice even today. There are exceptions both on client and server side, but you get so incredibly far with one thread, while eliminating so many potential bugs, that it’s borderline whether parallelism should even be exposed to application developers at all.

Even in Go which has my favorite parallel concurrency model, there are many footguns and needless walking on eggshells for business logic. You can still offload IO and bespoke compute to other threads when it makes sense. This view isn’t a panacea, but damn close for the 99% of use cases.

Coincidentally I also think the early success of JavaScript an largely be attributed to single-threaded run-loop and callback-oriented concurrency. Even on the server JS is still holding strong with this limitation, and that’s despite all the other limitations and insanity of JS.

monkeyelite · 1h ago
Absolutely - the idea of threads haphazardly interacting, like 2002 Java, is a terrible default assumption for designing languages and libraries.

It's not even clear the perf gains are great. Everything locking all the time has killed a lot of performance.

trevor-e · 7h ago
Main actor by default is a decent strategy. It's usually pretty obvious when something needs to happen off the main actor.
favorited · 5h ago
Especially in apps, where most of the code will be about preparing the user interface and handling events. And it's relatively easy to make most lower-level components actor-agnostic – either by making them conform to Sendable, by making them actors, or by giving them their own internal synchronization.
hn-acct · 7h ago
Everything probably already is or should be
ardit33 · 2h ago
Swift is amateur hour in action by academics that don't value practicality. The new Concurrency was ill thought, and done by people that just perhaps either don't have enough practical experience, or are so enamored with the actor paradigm (erlang) that they had to shove it down the throat in a ecosystem where it is not used that much. No one is really using Swift for distributed programing.

Glad they are backtracking on this, and I hope they start remove features and simplifying things. Swift's enemy is its own self and the people steering int into just an academic exercise, rather than a practical and performant language that can be used in many domains. Server side Swift right now is dead due to all these insane changes.

Hopefully things get better on the server/other non ios domains, but the language needs to get simplified and become practical and fun to use.

andrekandre · 1h ago

  > or are so enamored with the actor paradigm (erlang)
swift actors are barely actors in the erlang sense, not even close

maybe you're referring to structured concurrency?

90s_dev · 7h ago
> So, rather than writing > > @Test("Strip HTML tags from string") func stripHTMLTagsFromString() {...} > > we can instead write > > @Test func `Strip HTML tags from string`() {...}

Maybe I'm just really new at programming, but this seems like an absolutely bad feature, and the example actually perfectly proves it:

You really want to name a function "Hello World!" instead of helloWorld, just so your stack traces can pass a 5th grade English class exam?

90s_dev · 7h ago
It just seems to me that this is the exactly wrong way to solve a programming problem. If the problem boils down to "I want some variables (almost always test function names) to be more human readable", the solution should never be "hey let's add this feature to the core language and make identifiers use any ASCII string! I dunno, maybe I'm wrong here and being overly critical. But to me it just screams "Swift has lost the plot."
nulld3v · 5h ago
Many languages have had this feature for a long time. Ruby, ~~Rust,~~ Kotlin, etc... It hasn't been an issue at all.

I like that most languages seem to have reached consensus on backticks or other similarily awkward characters for this feature. Typing these identifiers is like hitting a speed bump, which seems to be enough to make devs avoid them except for very specific use-cases.

90s_dev · 2h ago
Now that you mention it, JavaScript has this inherent problem too:

> foo["hello world!"]()

I'm halfway glad I've never needed to write C++ professionally, but it seems to me like all my TypeScript would probably transliterate to very clean C++31.

0rzech · 5h ago
Rust does not have this feature. Function names can't have spaces, for example. Underscores are used instead. Maybe there are some macros for arbitrary ASCII strings - I don't know - but it's not a language feature.
nulld3v · 4h ago
Wow, you are correct! A Rust "raw identifiers" can be a reserved keyword. But other than that, all other normal identifier naming rules still apply...

And apparently I never figured this out even after 3 years of Rust lol, thanks!

raydev · 2h ago
> languages have had this feature for a long time. Ruby

Yes, that is precisely why I don't like Ruby, it's actually impossible for tools to reason about many things that would make finding bugs before shipping feasible. Big companies like Shopify have to impose a lot of restrictions on it to make it work at scale, which is silly. Just use a different language!

Now Swift may not be in this situation because it's added yet more characters to wrap this nonsense so it is possible to reason about, but it's still just unnecessary, and I will be adding a lint rule against it at work. I don't expect a lot of pushback if any.

jibal · 3h ago
Zig uses @"arbitrary name"

It's an important feature for FFI, as well as passing operator functions around. (It seems bizarre to me that you can't do `+` in Swift, but I don't know Swift so maybe there's another way to name such functions.)

Also, the Zig library now uses @"..." for variables with the same name as keywords, rather than using ad hoc naming conventions in those cases.

bbatsell · 7h ago
The HTTPStatus enum example is a good one, but the backtick syntax is _rough_. I would only ever use the Type.case form in practice. The test stuff is basically a way to create BDD-style test names, which is kind of just a preference thing. I can’t envision myself using it for anything other than weird case names (I already use case `default` quite a lot because it’s such a useful word), but maybe some interesting DSLs can come out of it? I would not have prioritized that change personally.
rTX5CMRXIfFG · 1h ago
The HTTP status enum example is a _terrible_ one. If you need to represent HTTP statuses and call them by their integer names, why not just pass the damn integer itself? It's exactly what you get in `HTTPURLResponse.statusCode`, and you can already `switch` against it. Already not looking forward to the code that undiscerning devs will mindlessly write just because someone with a huge following wrote a blog.
tiltowait · 3h ago
The backtick syntax for enums is rough, and typing out the full Type.case form negates one of Swift’s niceties (the ability to just type .case if the compiler can tell which enum is in use).
90s_dev · 6h ago
I would not have even approved it. But that's just me.
jibal · 3h ago
Test names are just an example. There are other valid reasons to be able to use arbitrary strings as names--importing functions from other languages and names that clash with keywords, for example.
seanmcdirmid · 7h ago
Tests are never called explicitly by programmers, or at least they never should be. You could argue that they don’t really need to be functions at all, just pieces of code that represent tests.
SwiftyBug · 7h ago
That's how Zig tests work. This is basically a function with a different syntax.

test "strip html tags from string" {

  ...

}
soegaard · 6h ago
The feature is fine but there are better reasons to introduce it.

For macro generated code it is convenient to use identifiers that people won't accidently use in their own code. The ability to use arbitrary identifiers solve that.

int_19h · 5h ago
The other reason is interop with other languages, which might have their own rules for identifiers.
codr7 · 6h ago
Except people can also use arbitrary identifiers in their own code now?
thedanbob · 7h ago
I don't know about other languages but Ruby is similar in that you can name a function with any string (though you might not be able to call it in the standard way) and the Rails default test framework takes advantage of that.
Jtsummers · 6h ago
https://tio.run/##S87JLC74/18jJTWtNE@hJiM1JydfoTy/KCelRkFDk0...

Common Lisp allows it as well, though I don't think I've ever seen it done outside a demonstration that it can be done.

rcruzeiro · 3h ago
This is useful for testing. Currently, I need to write both the string name of the text and an identifier based on that name for the function itself. Soon I will only need to write it once. This is not much useful for much else though, and just because you can write code like this, it does not mean you should.
wingerlang · 47m ago
Why do you need both an identifier and a text? I have this test name 'testAddingNewCardDataResultsInProperlyCombinedCardDataButNoNewCardsUnlocksBecauseWeStillHaveUnlearnedCards', and even though it is much longer than my other ones, it is still perfectly readable, and even if it wasn't, the only time I actually have to read it, is if it fails.
90s_dev · 3h ago
A better solution is to have a testing framework that doesn't rely on functions to name tests, especially in a language that has anonymous functions.
rcruzeiro · 3h ago
We have Quick for this — and while this framework is still a reasonable choice of a testing framework, I personally feel like the new Swift Testing framework is much nicer to write my test cases with.

https://github.com/Quick/Quick

hiccuphippo · 7h ago
Naming things is hard. If you can more accurately describe your test and not think of a separate name for it I'm all for it.

Also I like the backticks better than what zig came up with: @"404"

Starlevel004 · 4h ago
Kotlin has this, but it's basically only ever used for tests. I've never seen a real world method with a backtick name.
codr7 · 6h ago
There's a lot I love about Swift, but I fear it's quickly becoming too complicated for its own good.

There are just so many ways to solve a problem now that it's more or less impossible for someone to be familiar with all of them.

favorited · 5h ago
Many of these features have convoluted-sounding names like "global-actor isolated conformances" or "control default actor isolation inference," but they are changes that make actually using the language simpler.

People aren't expected to really learn that there is a "feature" called global-actor isolated conformances, but at some point they'll try to make a UI type conform to `Equatable,` and instead of an error saying you can't do that, they'll get a fixit about needing to specify the conformance as `struct MyUIType: @MainActor Equatable` instead.

I bet 99% of codebases won't use "method and initializer key paths," but there's really no reason why you should be able to get a key path to a property, but not a method. It just hadn't been implemented yet, and the language is more consistent now.

Personally, I think raw identifiers are kinda dumb, but that just means I won't use them. IMO there isn't really more cognitive overhead when using the language because it's possible to use spaces in function names now.

arecurrence · 6h ago
I too wish deprecation with migration path was a more common pattern in today's language development. The language has very much needed work and the numerous bugs within Apple's own libraries certainly hasn't helped.

That said, some of the, erm, "new ways" to solve problems have been significant advancements. EG: Async/Await was a huge improvement over Combine for a wide variety of scenarios.

storoj · 5h ago
IMO async/await and Combine are two completely different things.

What is the alternative to Combine's CurrentValueSubject or combineLatest()?

andrekandre · 11m ago

  > What is the alternative to Combine's CurrentValueSubject or combineLatest()?
combine latest et al can be found in async algorithms from apple*

https://github.com/apple/swift-async-algorithms

* though current value subject is not there its not hard to make one if you need it

lukeh · 5h ago
AsyncExtensions implements many Combine-like patterns in structured concurrency.
90s_dev · 6h ago
So it's becoming C++?
codr7 · 6h ago
That's my feeling, and it makes me sad because I have largely given up on C++ for that reason.
hirvi74 · 6h ago
Considering Swift was primarily written in C++, perhaps Swift was always destined to follow the same path?
rcruzeiro · 3h ago
So following this same reasoning Python should become C?
Hashex129542 · 4h ago
It's becoming Rust.
jimbokun · 3h ago
Yeah, I’m not an active Swift developer. But reading this article about all the existing complexity and all the new complexity in this update makes me think Swift has jumped the shark.
amichail · 6h ago
Is having too many ways to solve a problem an issue for solo indie developers?
jimbokun · 3h ago
It can be if you keep adding the new way of doing things and then need to debug code that jumps between all the different ways of doing things.
myHNAccount123 · 4h ago
Right? I don't get this persons sentiment and I don't understand how it relates to the post in particular.

No comments yet

90s_dev · 7h ago
I have not looked at Swift since I last wrote some around maybe v3. I hear that it's generally not a competitor to Rust, and is only really useful within the Apple ecosystem. Why is it not more useful as a C++ alternative, since I think that's kind of what the initial goal was? Is it just that non-Apple support is new-ish and not yet matured? Or a more fundamental issue?
porcoda · 6h ago
I use it as a C++ alternative on Linux. We ported a substantial code base from C++ to Swift last year and it works great. Performance is better in some places, comparable to C++ in others. Productivity is definitely improved over the C++ codebase. We didn’t use rust for this project after evaluating how that migration would impact how it was designed internally, and we decided it wasn’t the right way to go. I think the “swift is only relevant in apple ecosystem” view is inaccurate these days. Swift certainly isn’t the answer to every project, just like rust or any other language isn’t the universal answer to every project. It’s worth considering though if it is appropriate.
rcruzeiro · 3h ago
There is this belief that Swift is not really useful outside of the Apple ecosystem or is somehow clunky, and that could not be farthest from the truth. In fact, having written a few backends in Swift, I can say that the experience of writing a Swift backend on Linux was much more ergonomic than what I am used to with writing Swift for iOS.
afavour · 7h ago
There’s a level of self fulfilling prophecy here: people don’t use Swift off Apple platforms because there isn’t a critical mass of people using Swift off Apple platforms.

But that said it can be frustrating. A lot of the documentation and tutorials you find out there assume you’re on an Apple platform where, e.g. Foundation APIs are available. And the direction of the language, the features being added etc, very clearly serve Apple’s goals.

(Side note: IBM was an early adopter of Swift off-platform but then stepped back: https://forums.swift.org/t/december-12th-2019/31735)

rcruzeiro · 2h ago
Knowing which parts of Foundation will explode on your face on Linux is most of the challenge of doing non-Apple Swift code.
jshier · 44m ago
None, if you stick to using the bits from swift-foundation instead of swift-corelibs-foundation. Confusing, but the new code is much better, and in production on Apple's platforms as well.
jonny_eh · 7h ago
Apparently Arc Browser is written in Swift: https://www.reddit.com/r/ArcBrowser/comments/18j39g3/why_arc...
lukeh · 5h ago
Also using it in an embedded Linux project [1]. 75% of code written for this project is Swift. The rest is Dart and C/C++. It’s a productive language.

[1] https://forums.swift.org/t/an-embedded-audio-product-built-w...

Hashex129542 · 3h ago
For hobby programming at first I picked Java for the alternative to C++ and then Swift since 10 years. I really thought Swift language is the one which going to replace the Python. How dump I am. It's supposed to be. Because of SwiftUI, the direction of Swift language changed. The so called open source label is not fit to the Swift language. May be we can call it as free programming language by Apple.

I used vapor server also and now I think that Swift really has advantage for cross platform development. Just because of SwiftUI they've to adopt nonsense updates. IBM took greater decision on Kitura.

Vapor is still with Swift version 5.9; Let's see how it's ends.

briandear · 7h ago
Generally only useful within the Apple ecosystem is definitely inaccurate.

An example: https://vapor.codes/

The problem is that people only think it’s generally useful in the Apple ecosystem.

ackfoobar · 5h ago
I don't use Swift not because I think it's not useful outside Apple, but because I believe its developer experience is poor. Some stories that formed my opinions:

https://news.ycombinator.com/item?id=9947193

https://news.ycombinator.com/item?id=42803489

Granted, my perception may be wrong, but trying it to know for sure costs time. Swift has not earned my time investment.

rcruzeiro · 3h ago
The second example is moot since, outside the Apple ecosystem, you don't even need to know Xcode exists.
AnishLaddha · 7h ago
what advantages does swift offer over go/rust/js/java for server side programming? I always presumed the advantages of swift were native code compilation + top tier integration w/the apple ecosystem.
madeofpalk · 7h ago
In my little usage of it (and go and rust), Swift feels like a nice middleground between go and rust. Or, a better (safer) go.

I think Swift is vastly underestimated due to it's relation to Apple.

hocuspocus · 4h ago
I don't think people care about its relation to Apple, they care about the language ecosystem, roadmap and evolution that were shaped by Apple's needs for iOS and macOS before there was a real attempt at making Swift more general purpose and multi-platform. And now that it's somewhat there, there are better options in almost every dimension.
favorited · 7h ago
I have a few personal and professional Swift on server projects, in the wild and in the works. Code reuse is a big win – we can ~easily expose functionality of our client apps to other systems. Familiarity is another – there's an ocean of iOS (and, to a lesser extent, macOS) developers out there who are familiar with Swift. With a little bit of coaching, they can pretty quickly get up to speed with how services work.

It reminds me a lot of what it was like to ship Node.js software 15 years ago – the ecosystem is still young, but there are enough resources out there to solve 95% of the problems you'll face.

rcruzeiro · 3h ago
In my experience, writing Swift for the backend feels a lot like writing TypeScript, but nicer — though that’s just a personal preference. You get the performance of a compiled language like Rust (though that’s rarely a bottleneck for backend applications), but Swift is significantly easier than Rust and has much faster compile times.
amichail · 7h ago
It's a high level language that doesn't get in your way.
725686 · 6h ago
The advantage is obvious if you already use Swift.
ardit33 · 2h ago
They have stalled, and the concurency is making things harder to implement right.

Basically, Vapor has to be re-written as it is, in order to work will with swift 6+. Which kinda kills already any little moment it had.

Was looking to use it with a new project, as it is a nice framework, but going with GoLang on the server side due to all this in flux changes.

pkulak · 5h ago
You can't really say a language with a garbage collector (Swift) is an alternative to one without (Rust, C++, etc), because a lot of the time, the reason someone is using a non-GC language is because they don't want a GC.

EDIT: Yes, ref. counting is garbage collection, before the replies blow up. haha

favorited · 5h ago
> a language with a garbage collector (Swift)

You can certainly make the case that reference counting is a form of garbage collection, but it is absolutely false to say Swift has "a garbage collector." There is no runtime process that is responsible for collecting garbage – allocated objects are freed deterministically when their reference count hits zero.

The same thing is true of `shared_ptr` instances in C++, and there's certainly no "garbage collector" there, either.

pkulak · 3h ago
That reference counting is done at runtime. It’s a runtime garbage collector. It’s different than a generational GC, but it’s GC. Those cycles to increment and decrement a counter attached to every object at ever touch aren’t free. All the downvotes in the world won’t make that free.
favorited · 2h ago
> It’s a runtime garbage collector

What does "it" refer to? The function calls to _swift_release_()? Because if function calls are a "garbage collector," then free() is a garbage collector. And if free() is a garbage collector, then the term is too vague to have any useful meaning.

Hashex129542 · 4h ago
Mostly nonsense updates.

Swift was my favorite programming language after C++/Java since 2014. I've been faced major updates few times happily. It was one of the most easiest language. But now,

I tried to update a project from Swift 5.x to 6.x which has 150+ source files itself and no external libraries which is written by my own use and it has almost all swift 5.x features. They made up Swift as super hard. I decided not to use Swift 6 anymore and yes I don't need to reduce debugging time, Even though I don't have powerful computer and debugging time isn't matter to me & development time is actual matter to me.

The language itself becomes Rust (the programming language using by aliens). I Hope Swift language is upgrading itself for Aliens or the Swift team is filled with Aliens. Now, I feel ObjC is super easiest language than Swift.

PS: I understand Swift is Corporate Product & upgrading towards SwiftUI than general purpose programming language. I never gonna use Swift 6 even I do use ObjC for my projects.

wsc981 · 3h ago
I find 'simple' languages charming. Hence, I still like Objective-C. I also like Lua a lot.

I liked Swift when I tried it a couple of years ago, but it seems overloaded with features these days. I haven't tried Swift UI yet, but I did think the Objective-C approach with xibs, struts and such worked fine.

wingerlang · 1h ago
There is probably around a decade-long leap between XIB and SwiftUI. XIB files are only found in legacy code nowadays. It might have worked fine in smaller projects, but I think there are good reasons why it was left behind.

In my experience, most XIB files were either so small and easy that it was simply easier to replicate it in ten lines of code. Or so giant an impenetrable that it took thousands of lines of code to replicate it with, and at that point most people prefer to work with code over a dense XIB file.

rcruzeiro · 3h ago
xibs were an absolute nightmare if you worked with a team. Even in the Objective-C days a lot of developers were sticking with programatic layout to avoid xibs. Google even had this mandated in their Objective-C style guide.
cosmic_cheese · 1h ago
On iOS, code-only UIKit with bits of SwiftUI interspersed for simple components (think collection view cells) is definitely the way to go. UIKit is well equipped to be written that way (unlike Android Framework, which practically forces use of XML layouts in many cases).

For Mac dev, AppKit is still fairly heavily weighted towards use of XIBs, but it’s not nearly as much of an issue there because on average each individual XIB isn’t as overloaded with controls because the UI is more split up.

ardit33 · 2h ago
I don't use the new concurrency features, as they are one of the main culprits of this mess. (so stick with 5.x)

SwiftUI is a wreck, that is still not good for advanced UI and you still have to use UIKit for some parts, and

Taking Objective-C, with DispatchQueue, and some modernization of it, and some new data structures, which it need, was all it was needed to make a good new langue.

It could have been Apple's rival to GoLang, but instead it ended up being hydra/monster with too many pardagimns, and none of them are good.