What's New in Swift 6.2?

https://news.ycombinator.com/rss Hits: 5
Summary

Brace yourselves, folks: Swift 6.2 contains another gigantic collection of additions and improvements to the language, while also adding some important refinements to Swift concurrency that ought to make it much easier to adopt everywhere. Many changes are small, such as the addition of raw identifiers, default values in string interpolation, or enumerated() conforming to Collection, but these are all likely to spread quickly across projects because they are just so darned useful. It's also great to see Swift Testing going from strength to strength, with three major improvements coming in Swift 6.2, including exit tests and attachments. In short, it feels like Swift 6.2 is delivering what many imagined Swift 6.0 would be – increasingly rounded support for concurrency, backed up by a number of pragmatic choices that help smooth out the language's learning curve. Note: At the time of writing, Swift 6.2 is available only as a test release from Swift.org. The list below represents my best guess for what's coming up – don't be surprised if something slips to a later or release or something else arrives by surprise! Sponsor Hacking with Swift and reach the world's largest Swift community! Control default actor isolation inference SE-0466 introduces the ability for code to opt into running on a single actor by default – to effectively go back to being a single-threaded program, where most code runs on the main actor until you say otherwise. Yes, this is exactly as good as you're thinking: with one single change many app developers can more or less avoid thinking about Swift concurrency until they are ready to do so, because unless they say otherwise all their types and functions will behave as if it were annotated with @MainActor. To enable this new feature, add -default-isolation MainActor to your compiler flags, and code like this becomes valid: @MainActor class DataController { func load() { } func save() { } } struct App { let controller = DataController() init() { con...

First seen: 2025-05-09 21:16

Last seen: 2025-05-10 01:17