Can a macro generated initializer keep the memberwise initializer?

It's correct that macros in current form can't create an extension, and writing your own initializer would prevent the compiler from automatically synthesizing a memberwise one for your struct.

Holly has added a proposal to generalize the conformance macro role to an extension macro role. If this is accepted and implemented, you could use an extension macro to add your custom initializer as an extension of your struct, without interfering with the memberwise initializer synthesized by Swift.

Hope this helps! :heart:

3 Likes