~/talk

Swift Macros

Talkat Swift Craft 2024 · 2024-05-21..05-24· [compilers-and-language-design, swift]
links:none on file
slides:none on file

Shows how to build two working compiler plugins using Xcode and SwiftSyntax: a freestanding macro that expands a string literal into URL("https://...") and emits compile‑time errors if the argument isn’t HTTPS, and an attached macro that scans non‑static properties and generates an extension listing their names. Live demos run and unit tests pass. Notes practical costs: SwiftSyntax adds ~30s debug builds (up to ~4min release on M1), debugging requires running macro tests with breakpoints, and formatting fragility breaks tests.

AI-written summary · about

  1. 0:00Introduction and thanks
  2. 1:08What are Swift macros
  3. 4:22Creating a new macro
  4. 8:03Exploring SwiftSyntax
  5. 15:45Building first macro
  6. 17:59Secure URL macro
  7. 24:07Listable properties macro
  8. 31:21Macro shortcomings
  9. 33:55Debugging macros
  10. 34:18Recap and resources
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.