Today I'm launching MacroBrewery, a collection of simple macros for generating boilerplate code in Swift. It can generate code for memberwise inits, builder pattern, enum accessors, test stubs, and more.
Blog post: https://edc.me/posts/introducing-macrobrewery/
Repo: https://github.com/evandcoleman/MacroBrewery
Introducing MacroBrewery: A Collection of Swift Macros for Code Generation
If you’ve worked on a Swift codebase of any size, you’ve written the same boilerplate code hundreds of times. Memberwise initializers. Builder patterns. Enum case accessors. Test stubs. It’s tedious, error-prone, and frankly, boring. Swift 5.9 introduced macros, and I finally had a way to solve this properly. So I built MacroBrewery, a collection of macros that generate the repetitive code I was tired of writing by hand. What’s Included @AutoInit Generates memberwise initializers that improve on Swift’s built-in one: optionals default to nil, properties with default values preserve them as parameter defaults, and you can set any access level.