Can Swift macros generate a new top-level type based on existing types?

Can DeclarationMacro accomplish this?

Hi! Depending on what you mean by based on existing types, this sounds like either a freestanding declaration macro or an attached peer macro. You can learn more about writing macros by watching WWDC videos:

or reading the SwiftUI Evolution Proposals:

Peer macros can solve my problem :blush:

1 Like