[Accepted] SE-0293: Extend Property Wrappers to Function and Closure Parameters

The third review of SE-0293 has concluded. Feedback in the third round of review was quite positive, a result of the great iteration from the previous rounds of proposal. As such, the core team has accepted the proposal as written.

Thank you to the proposal authors and to the community for the discussion and iteration, and for helping make Swift a better language!

Chris Lattner
Review Manager

22 Likes

Does the acceptance of proposal imply that we will get the ability to apply property wrappers onto constants?

@Wrapper
let constant = 42

The proposal enforces a similar behavior with function parameters where the backing storage is a constant and the synthesized computed variables are read only.

No; the only additional capabilities of property wrappers gained with the acceptance of this proposal are the capabilities specified in the proposal.

I do think it would be useful to have a way to declare that the backing storage is immutable for a wrapped property or local variable, but that will need to be a separate proposal.

3 Likes

That however is exactly what I was asking, sorry if you got the impression that I was asking as if we get it now, that was some bad wording.

4 Likes

Hello,
I saw here that this feature is included in Swift 5.5.
Is it mentioned somewhere in the official documentation?
I couldn't find anything but maybe it has been renamed to something else now that wrappers are no longer limited to properties.

Thanks

I didn't find anything in the language guide, so probably no.

Of course, you can always check out the proposal, or other educational resources like Swift by Sundell's article on this feature.

Filip

1 Like

Ok thank you for the confirmation.
The example given in the "What's new in Swift" WWDC session was a bit confusing.
But reading the "Detailed design" section in the proposal was very helpful.
Maybe the official language guide could link to the proposal? Or maybe it will get updated later.
Thanks.

2 Likes
Terms of Service

Privacy Policy

Cookie Policy