Init accessors in Swift 5.9

Episode Clip • Oct 18, 2023

Init accessors are a new feature in Swift 5.9, and they sit right alongside get and set accessors, and even the underscored _read and _modify accessors that have not been “officially” added to the language yet.

Init accessors allow you to write initializers that set computed properties in the type even before all of the stored properties are set. This was a necessity in order to make macros work as seamlessly as possible.

This is an excerpt from our series of episodes on the Observation framework in Swift.

Get started with our free plan

Our free plan includes 1 subscriber-only episode of your choice, access to 64 free episodes with transcripts and code samples, and weekly updates from our newsletter.

View plans and pricing