Pages: 332
Published: August 2024
ISBN: 9781944994068
In Print
The Case of the Vanishing Bodies is an introduction to the magic of freestanding and attached Swift Macros. You’ll learn to create a variety of macros. You’ll get a feel for when you should and shouldn’t create them, which sort of macro you should create, and how to use SwiftSyntax to implement them.
This work was written and produced entirely by the author. We are proud to be distributing it.
PDF for desktop/tablets
epub for Apple Books, e-readers
Get all eBook formats here for $30.00 (USD)
The Case of the Vanishing Bodies is an introduction to the magic of freestanding and attached Swift Macros.
There’s a fair amount of boilerplate code involved in so many of our everyday tasks as Swift programmers. Until Xcode 15, every time we created a new SwiftUI View we had to create the corresponding preview code. The struct and computed property weren’t interesting in any way - they were just a necessary task we needed to perform to display a preview of our View. With the introduction of the #Preview macro, we now only need to provide the code required to create an instance of the view being displayed.
In this book you’ll learn to create a variety of macros. You’ll get a feel for when you should and shouldn’t create them, which sort of macro you should create, and how to use SwiftSyntax to implement them. Your macros will accept parameters when appropriate and will always include tests. You’ll even learn to create helpful diagnostics for your macros and even FixIts.
You will need a Mac running the Xcode 15 or above.
Source code, Errata, Typos, Suggestions
Releases:
Prelude: Before we Begin
Chapter 1: A Look Around excerpt
Chapter 2: Our First Macro
Chapter 3: Freestanding Macros excerpt
Chapter 4: Our First Attached Macro
Chapter 5: More Attached Macros excerpt
Daniel H Steinberg is the author of more than a dozen books including the best selling books A Functional Programming Kickstart, A Swift Kickstart, Second Edition and Dear Elena. He has written apps for the iPhone and the iPad since the SDKs first appeared and has written programs for the Mac all the way back to System 7.
Daniel presents iOS, Functional Programming, SwiftUI, and Swift training and consults through his company Dim Sum Thinking. When he’s not coding or talking about coding for the Mac, the iPhone, and the iPad he’s probably cooking, baking bread, or hanging out with friends. Details on his training and speaking are on the Dim Sum Thinking website.
PDF for desktop/tablets
epub for Apple Books, e-readers
Get all eBook formats here for $30.00 (USD)
Pages: 332
Published: August 2024
ISBN: 9781944994068
Edition: 1
In Print