---
title: "Swift Macros at scale"
url: https://daily.dev/posts/swift-macros-at-scale-lb9v10har
source_url: https://tuist.dev/blog/2024/08/26/swift-macros
type: article
source: "\n      Tuist\n    "
published: 2026-08-23T12:23:50.443Z
updated: 2026-08-23T12:56:10.066Z
tags: ["swift", "webassembly"]
reading_time: 6
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Swift Macros at scale

**[
      Tuist
    ](https://daily.dev/sources/tuist-blog)** · 6 min read · 0 upvotes · 0 comments

## Summary

Swift Macros, introduced alongside Xcode 15, generate code via the compiler but significantly slow down build times because each macro must compile SwiftSyntax and its ten-plus transitive dependencies. Benchmarks on a MacBook Air M2 show a clean release build of a fresh macro package taking roughly 196 seconds. The piece explores why this happens, including SwiftSyntax's lack of API/ABI stability, and outlines three potential fixes: making SwiftSyntax API/ABI stable, compiling macros to WebAssembly via WasmKit for cross-platform binary execution, and fingerprint-based binary caching. Tuist has already implemented binary caching for Swift Macros via its 'tuist cache' command to speed up local and CI builds.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://tuist.dev/blog/2024/08/26/swift-macros>

## Questions this post answers

### Why do Swift Macros make my build times so much slower?

Swift Macros require the compiler to build SwiftSyntax and its more than ten transitive dependencies, then statically link them into a binary executable for each macro. A clean release build of a freshly created macro package takes around 196 seconds on a MacBook Air M2 with 16GB RAM, and adding more macros compounds this cost further.

_daily.dev surfaces practical fixes like these for developers wrestling with slow Swift build pipelines._

### Can I use WebAssembly to speed up Swift Macro compilation?

Yes, this is a proposed approach discussed in the Swift community forums: compiling Swift Macros to .wasm binaries and running them via the WasmKit runtime instead of statically linking SwiftSyntax on every build. This would solve build slowness on Darwin, Windows, and Linux without requiring ABI stability changes, though it is not yet officially adopted by Apple.

_Developers tracking emerging Swift tooling proposals can follow discussions like this on daily.dev._

### How does Tuist cache Swift Macros to speed up Xcode builds?

Tuist extends its binary caching feature to Swift Macros, frameworks, and bundles by fingerprinting them so subsequent builds reuse previously generated binaries instead of recompiling. Running the command 'tuist cache' stores these binaries, and anyone on the team generating an Xcode project afterward benefits from the cached artifacts, avoiding the repeated cost of compiling SwiftSyntax dependencies.

_daily.dev helps teams comparing Swift build caching tools stay on top of tooling changes._

---

Tags: [#swift](https://daily.dev/tags/swift), [#webassembly](https://daily.dev/tags/webassembly)

[View this post on daily.dev](https://daily.dev/posts/swift-macros-at-scale-lb9v10har)
