Member-only story
Swift 5.9 Will Make Apps Faster And Safer

Safer casting due to new warnings and banned not really unavailable properties pale in comparison with the concept of ownership that will bring the new quality into mission critical Swift code
Two months ago Swift 5.8 was released. One of the major changes introduced was the ability to test future features. It may sound similar for developers writing in other programming languages.
Possible Faster Swift Development
For example Java uses a complex system of feature states where the preview state means developers are asked to test a feature before it becomes a part of the standard release.
The same possibility in Swift may mean that it is prepared for faster development and more features to come in the following years.
Something every Swift developer will accept with open arms.
Now, with the 5.9 four tickets we’re finished. One revolves around conversion warnings, second bans unavailable stored properties, third introduces consume statement, and the last one let’s you decide if your function takes arguments by consuming or borrowing.
Let’s go over these changes and fixes.
🪄 Swift 5.9: Safer Casting
As Andrew Trick from Apple explains, sometimes you may want to extract data from a variable or parameter, but unwillingly get an internal representation.
For example like this:

The code should not contain & before string to get the bytes.
Usually such and other conversions touching the internal state are accidental and lead to some tricky to debug errors, not to mention security issues.
The introduced change warns developer about such weird operstions. Usually these warnings will act as a reminder to fix a typo.
In a case such dangerous conversion is intended, developer has the option to use explicit…