Swift 5.5 Released
Swift 5.5 is a massive release, which includes newly introduced language capabilities for concurrency, including
async/await
, structured concurrency, and Actors.[…]
- SE-0293 Extend Property Wrappers to Function and Closure Parameters
- SE-0295 Codable synthesis for enums with associated values
[…]
Before Swift 5.5, if we wanted to make an enum that contains associated values conform to
Codable
, then we’d have to write all of that code manually. However, that’s no longer the case, as the compiler has received an upgrade that now makes it capable of auto-synthesizing serialization code for such enums as well.[…]
If needed, we could even customize what keys that are used for the associated values within a specific case. For example, here’s how we could declare that we’d like the youTube case’s id value to be serialized as youTube
In general, these kinds of issues can be worked around using a compile-time platform check — but before Swift 5.5, we’d have to first break our
List
out into a separate expression, and then apply differentlistStyle
modifiers separately using an#if
-based operating system condition[…][…]
When using Swift 5.5, we now have the option to inline
#if
directives right within our expressions. So, going back to ourItemList
, we can now conditionally apply each of ourlistStyle
modifiers completely inline — without first having to break our expression up into multiple parts[…]
Sadly, these [async/await] features require runtime support. Which means, at least for the time being, async is iOS 15-/macOS 12-only.
For those of us supporting older deployment targets, this can be a bit of a let down. But not all hope is lost! We can build clean, flattened-out async handling on our own.
If your incremental (i.e. Debug) builds seem to be too slow, here some things to try[…]
Previously:
- Creating Compile-Time Reminders in Xcode
- Xcode 13 RC
- Swift 5.4 Released
- Swift Proposal: Actors
- Swift AsyncSequence
- Swift Concurrency Interoperability With Objective-C
- Swift Proposal for async/await
Update (2021-10-05): taylorswift:
I’ve discovered several stack corruption bugs related to
async
/await
which can be reproduced in simple test programs compiled with recent nightly toolchains. i have confirmed that four of these bugs are present in the 5.5-RELEASE toolchain.