CommentComment

Macros in Swift are this yearā€™s big language feature. Iā€™m sure youā€™ve already watched the excellent Write Swift macros and Expand on Swift macros WWDC session videos, but what comes after that?

We immediately put them in our production code and hope for the best, right? šŸ˜¬

I wrote something similar when Swift 5.4 introduced result builders, and we saw a proliferation of experiments. Now weā€™re in that same period with macros.

The package index is already filling up with packages that contain macros, and it makes me glad we added 5.9 support so quickly. Some of the packages Iā€™m linking to below will become essential parts of the Swift package ecosystem, and some will remain experiments. Itā€™s impossible to know which yet!

Thereā€™s everything from full-featured packages like SwiftRequest and papyrus that let you define a type-safe HTTP client with function annotations to smaller utility packages like AssociatedObject, which allows variable storage in extensions. There are many, many more though. Hereā€™s a list of others I saw this week:

Thereā€™s another advantage of having these packages available as open-source. They are educational resources, too! Are you curious about how you might want to use macros in your apps? Take a look through the source of some of the packages linked above. Iā€™m sure youā€™ll learn something.

Dave Verwer  

News


Code




Design


Jobs

iPad Software Engineer @ Liquid Instruments ā€“ Liquid Instruments is a startup creating a range of modern test and measurement devices using reconfigurable FPGA hardware. We're looking for someone to help develop the beautiful iPad user interface that drives it all. ā€“ On-site (Australia)

 

And finally...

I said ā€œbut Craig uses it!ā€ šŸ’„