Macros Beta


« Something old, something new

Release of Macros Book »

Last year I taught three workshops. In addition to my two-day Async workshop, I created a one day workshop on Data Flow in SwiftUI that ended with a look at Observable and Swift Data. That became my book, The Mystery of the Mutating Mannequin.

I also taught a workshop on Swift Macros at NSSpain, Pragma Conference, do iOS, at at a public workshop in London that I organized with Paul Ardelaneau.

I'm completing a book based on this workshop and the beta, which includes the prelude and the first two chapters, is available today.

This is another book in the Edges and Swiftly series and is called The Case of the Vanishing Bodies. The subtitle is "An Introduction to Swift Macros".

Chapter 1 looks at macros you may have encountered while working with SwiftUI. Before we build our own, it's good to take a look at examples such as #Preview and @Model.

Chapter 2 walks you step-by-step through the creation of a freestanding expression macro in a Swift Package.You'll see why we extract the information we need from the input code using SwiftSyntax and why we build the resulting code from Strings.

Chapter 3 will look at more examples of freestanding macros as well as diagnostics and FixIts. In Chapter 4 you build your own attached macro and in Chapter 5 we look at more examples of attached macros.

Whether or not you are going to build your own macros, this book will take the mystery out of them and show you how the magic is done.

I hope you enjoy it.