Macros in Swift are this 12 months’s large language characteristic. I’m certain you’ve already watched the superb Write Swift macros and Broaden on Swift macros WWDC session movies, however what comes after that?
We instantly put them in our manufacturing code and hope for one of the best, proper? 😬
I wrote one thing comparable when Swift 5.4 launched end result builders, and we noticed a proliferation of experiments. Now we’re in that very same interval with macros.
The bundle index is already filling up with packages that comprise macros, and it makes me glad we added 5.9 help so rapidly. A number of the packages I’m linking to beneath will change into important elements of the Swift bundle ecosystem, and a few will stay experiments. It’s inconceivable to know which but!
There’s all the pieces from full-featured packages like SwiftRequest and papyrus that allow you to outline a type-safe HTTP consumer with perform annotations to smaller utility packages like AssociatedObject, which permits variable storage in extensions. There are various, many extra although. Right here’s a listing of others I noticed this week:
There’s one other benefit of getting these packages obtainable as open-source. They’re instructional assets, too! Are you interested in the way you would possibly need to use macros in your apps? Have a look by the supply of among the packages linked above. I’m certain you’ll study one thing.