Can anyone recommend a good reference on @functionbuilder?

I'm working on a project that seems it would be a good fit for @functionbuilder, but I'd like to deeply understand more than just buildBlock. Can anyone recommend a good reference for all the other functions?

Maybe this original (public) pitch together with the linked draft proposal, and recent implementation progress.

Note still that function builder is not formalized into the language yet, and can be subjected to change, iow, thread with care.


Not really a reference but this blog post was a great read

1 Like

Search for @_functionBuilder on the main swift repo and try to understand the test files. They help a lot.


In case you're wondering @_functionBuilder is omitted from "The Swift Programming Language" today because that attribute isn't officially part of the language (as indicated by the leading underscore). In the future, after it goes through the Swift Evolution process and is approved, TSPL will be updated to document what it means and how to use it.


Thanks everyone, lots of great info here. Managed to make the project work, and really enjoyed the results. I'm using function builders to generate a generic dispatch layer for C XPC and it works really well.