Getting started with Swift Macros (part 2)

In this intro we will explore the new features in Swift Macros and the existing features they build upon.

* We start the day with an extended look at how we might transition our code from using @Published and ObservableObjects to the new Observable macro. Along the way we’ll see an example that uses AsyncStreams which will suggest a first macro of our own that we can create.

* We’ll begin by looking at the various situations in which macros might and might not be appropriate and try to convince you not to reach for them too quickly.

*We examine the different types of macros that are available in Swift 5.9 and have actual examples of why it’s important to select the appropriate type.

*We’ll consider what’s involved in basic parsing before digging into parsing an Abstract Syntax Tree using SwiftSyntax to pull out the pieces you need for your macro. We put in error handling and write tests to make our macros more robust.


Session info:

Speaker: Daniel Steinberg

Storyteller at Dim Sum Thinking at Dim Sum Thinking

Date: 12 March 2024

Time: 13:30 - 17:00

Relevant tags:
iOS Swift

See all speakers

See all videos